var __extends, NineYi;
(function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            (function (n) {
                n[n.None = 0] = "None";
                n[n.CardNo = 1] = "CardNo";
                n[n.CardMonth = 2] = "CardMonth";
                n[n.CardYear = 3] = "CardYear";
                n[n.CVV = 4] = "CVV"
            })(n.FocusInputTypeEnum || (n.FocusInputTypeEnum = {}));
            var t = n.FocusInputTypeEnum
        })(t = n.Models || (n.Models = {}))
    })(t = n.Mall || (n.Mall = {}))
})(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var i = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        return n ? (n = parseFloat(n), n % 1 == 0 && (n = n.toFixed(0)), "$" + n) : "$0"
                    }
                }, n
            }(), t;
            n.PriceFilter = i;
            t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        return n === 0 ? null : n
                    }
                }, n
            }();
            n.ZeroToNullFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsPrice", ["$log", i.Factory]).filter("nsZeroToNull", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n, t, i) {
                        t = parseInt(t);
                        i = parseInt(i);
                        for (var r = t; r <= i; r++)n.push(r);
                        return n
                    }
                }, n
            }();
            n.RangeFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsRange", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        return n.slice(0).reverse()
                    }
                }, n
            }();
            n.ReverseFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsReverse", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n, t) {
                        var r = parseInt(n, 10), i;
                        if (t = parseInt(t, 10), isNaN(r) || isNaN(t))return n;
                        for (i = "" + r; i.length < t;)i = "0" + i;
                        return i
                    }
                }, n
            }();
            n.NumberFitLengthFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsNumberFitLength", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        var i = "", t;
                        return n != null && (t = n.split("v="), t.length <= 1 && (t = n.split("youtu.be/")), t.length > 1 && (i = "https://img.youtube.com/vi/" + t[1] + "/0.jpg")), i
                    }
                }, n
            }();
            n.YoutubeImgParser = t;
            angular.module("NineYi.Mall.Filters").filter("nsYoutubeImgParser", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        var t;
                        if (n)return (t = "/Date(-62135596800000)/", n === t) ? null : new Date(parseInt(n.replace("/Date(", "").replace(")/", ""), 10))
                    }
                }, n
            }();
            n.DotNetDateParser = t;
            angular.module("NineYi.Mall.Filters").filter("nsDotNetDateParser", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var r = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        if (n) {
                            var t = n.getMonth() + 1, i = n.getDate();
                            return n.getFullYear() + "-" + (t > 9 ? t : "0" + t) + "-" + (i >= 10 ? i : "0" + i)
                        }
                    }
                }, n
            }(), t, i;
            n.DateFormatParser = r;
            t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        if (n) {
                            var t = new Date(n);
                            return t.toLocaleDateString()
                        }
                    }
                }, n
            }();
            n.DateStringShortFormatParser = t;
            i = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        if (n) {
                            var t = n.split("-");
                            return new Date(t[0], t[1] - 1, t[2])
                        }
                    }
                }, n
            }();
            n.DateStringFormatParser = i;
            angular.module("NineYi.Mall.Filters").filter("nsDateFormatParser", ["$log", r.Factory]).filter("nsDateStringFormatParser", ["$log", i.Factory]).filter("nsDateStringShortFormatParser", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        return n ? n.replace("/t/", "/o/") : n
                    }
                }, n
            }();
            n.InitImageSizeFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsInitImageSize", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function (n, t) {
                    return function (n) {
                        if (n) {
                            var i = n.replace("/t/", "/z/");
                            return i + "?quality=" + t.imageQuality
                        }
                        return n
                    }
                }, n
            }();
            n.OptimizeImageFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsOptimizeImage", ["$log", "Mall.Config", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n) {
                        return n ? String(n).replace(/<[^>]+>/gm, "") : ""
                    }
                }, n
            }();
            n.HtmlToPlanText = t;
            angular.module("NineYi.Mall.Filters").filter("nsHtmlToPlanText", t.Factory)
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (t) {
            var i = function () {
                function t() {
                }

                return t.Factory = function () {
                    return function (t) {
                        var i = "專屬", u = n.Configs.RegexPattern.Chinese, f = n.Configs.RegexPattern.NumberAndEnglish, r = t.substring(0, 1);
                        return u.test(r) ? t.length <= 3 ? i = t : "" : f.test(r) && (t.length <= 6 ? i = t : ""), i
                    }
                }, t
            }();
            t.CrmTierNameFilter = i;
            angular.module("NineYi.Mall.Filters").filter("nsCrmTierNameFilter", ["$log", i.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.Factory = function () {
                    return function (n, t, i) {
                        if (n)return t = isNaN(t) ? 10 : t, i = typeof i == "undefined" ? "..." : i, n.length <= t || n.length - i.length <= t ? n : String(n).substring(0, t - i.length) + i
                    }
                }, n
            }();
            n.TruncateTextFilter = t;
            angular.module("NineYi.Mall.Filters").filter("nsTruncateText", ["$log", t.Factory])
        })(t = n.Filters || (n.Filters = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.config = n;
                    this.ApiCdnConfig = t
                }

                return n.prototype.getWebApiUrl = function (n) {
                    var t = "", i, r;
                    return this.ApiCdnConfig.IsEnable ? (i = n.indexOf("?") === -1 ? "?" : "&", r = i + "site=" + window.location.hostname, t = this.ApiCdnConfig.Url + "/webapi" + n + r) : t = this.config.webapiUrl + n, t
                }, n.$inject = ["Mall.Config", "ApiCdnConfig"], n
            }();
            n.WebApiFactory = t;
            angular.module("NineYi.Mall.Factories").factory("WebApiFactory", ["Mall.Config", "ApiCdnConfig", function (n, i) {
                return new t(n, i)
            }])
        })(t = n.Factories || (n.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Factories").factory("AndroidHelper", ["Mall.Config", function (n) {
                return typeof Android != "undefined" && n.enableAndroidHelper ? Android : null
            }])
        })(t = n.Factories || (n.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Factories").factory("stacktrace", function () {
                return {print: printStackTrace}
            })
        })(t = n.Factories || (n.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Factories").factory("underscore", function () {
                return _
            })
        })(t = n.Factories || (n.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function () {
            angular.module("NineYi.Mall.Factories").factory("CartBaseClass", function () {
                return n.Mall.BL.CartBaseClass
            }).factory("CartClass", function () {
                return n.Mall.BL.CartClass
            }).factory("TemperatureClass", function () {
                return n.Mall.BL.TemperatureClass
            }).factory("MerchandiseClass", function () {
                return n.Mall.BL.MerchandiseClass
            }).factory("DeliveryClass", function () {
                return n.Mall.BL.DeliveryClass
            }).factory("PaymentClass", function () {
                return n.Mall.BL.PaymentClass
            }).factory("InstallmentClass", function () {
                return n.Mall.BL.InstallmentClass
            }).factory("DeliveryInfoClass", function () {
                return n.Mall.BL.DeliveryInfoClass
            }).factory("PromotionClass", function () {
                return n.Mall.BL.PromotionClass
            }).factory("ReachQtyClass", function () {
                return n.Mall.BL.ReachQtyClass
            }).factory("FreebieClass", function () {
                return n.Mall.BL.FreebieClass
            }).factory("ECouponClass", function () {
                return n.Mall.BL.ECouponClass
            }).factory("PromotionDetailClass", function () {
                return n.Mall.BL.PromotionDetailClass
            }).factory("PromotionListClass", function () {
                return n.Mall.BL.PromotionListClass
            }).factory("MemberCardClass", function () {
                return n.Mall.BL.MemberCardClass
            }).factory("CardListClass", function () {
                return n.Mall.BL.CardListClass
            })
        })(i = t.Factories || (t.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = n.Mall.Models.PageNameEnum, r = function () {
                function n(n, t) {
                    this.deviceValue = n;
                    this.pageValue = t;
                    this.IsEnableSmartAppBanner = !1;
                    this.IsEnableToolbox = !1;
                    this.IsMobile = !1;
                    var i = this.pageValue.CurrentPage, r = this.deviceValue.IsMobile();
                    this.IsEnableToolbox = this.CheckIsEnableToolbox(i, r);
                    this.IsEnableSmartAppBanner = this.CheckIsEnableSmartAppBanner(i, r)
                }

                return n.prototype.CheckIsEnableSmartAppBanner = function (n, t) {
                    var r = !0;
                    return (n === i.SalePageIndex && t === !0 || n === i.PromotionDetail && t === !0 || n === i.PayIndex || n === i.PayFinish || n === i.ShoppingCartIndex) && (r = !1), r
                }, n.prototype.CheckIsEnableToolbox = function (n) {
                    var t = !1;
                    return (n === i.OfficailIndex || n === i.CouponDetail || n === i.CouponList || n === i.ECouponDetail || n === i.ECouponHowToUse || n === i.ECouponList || n === i.HotSaleRanking || n === i.NewestSalePage || n === i.PromotionDetail || n === i.PromotionList || n === i.SalePageCategory || n === i.SalePageIndex || n === i.SearchIndex || n === i.FreeGiftPromotionDetail) && (t = !0), t
                }, n.$inject = ["DeviceValue", "PageValue"], n
            }();
            t.ComponentControlFactory = r;
            angular.module("NineYi.Mall.Factories").factory("ComponentControlFactory", ["DeviceValue", "PageValue", function (n, t) {
                return new r(n, t)
            }])
        })(i = t.Factories || (t.Factories = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.$filter = r
                }

                return t.prototype.GetOfficialPreferenceCategoryList = function (n, t, i, r) {
                    for (var f = this.$q.defer(), e = {
                        orderby: "Curator",
                        startIndex: i || 0,
                        maxCount: r || 10,
                        shopId: n || 0,
                        cidList: []
                    }, o = this.config.webapiUrl + "/SalePage/GetOfficialPreferenceCategoryList?id=" + n, u = 0; u < t.length; u++)t[u].TargetInfo.TargetId && t[u].TargetInfo.TargetId !== "" && e.cidList.push(+t[u].TargetInfo.TargetId);
                    return this.$http.post(o, e).success(function (n) {
                        f.resolve(n.Data)
                    }).error(f.reject), f.promise
                }, t.prototype.GetSalePage = function (n, t) {
                    var u = this, i = this.$q.defer(), r = this.config.webapiUrl + "/SalePage/GetSalePage/" + n;
                    return t && (r += "?cid=" + t), this.$http.get(r).success(function (n) {
                        var t = new Date;
                        n.data.Promotions = n.data.Promotions.filter(function (n) {
                            return u.$filter("nsDotNetDateParser")(n.StartTime) <= t
                        });
                        i.resolve(n)
                    }).error(i.reject), i.promise
                }, t.prototype.GetOfficialRecommendSalePageList = function (n, t, i, r, u) {
                    var s = this.$q.defer(), f = {
                        orderby: i || "Newest",
                        startIndex: r || 0,
                        maxCount: u || 50,
                        shopId: n || 0,
                        cidList: []
                    }, e = this.config.webapiUrl + "/SalePage/GetOfficialRecommendSalePageList", o;
                    for (e += "?shopId=" + f.shopId, e += "&orderby=" + f.orderby, e += "&startIndex=" + f.startIndex, e += "&maxCount=" + f.maxCount, o = 0; o < t.length; o++)f.cidList.push(t[o].TargetInfo.TargetId);
                    return this.$http.post(e, f).success(function (n) {
                        s.resolve(n.Data)
                    }).error(s.reject), s.promise
                }, t.prototype.GetSalePageStatus = function (n) {
                    var t = this.config.webapiUrl + "/SalePageStatus/GetSalePageStatus/" + n;
                    return this.$http.post(t, null)
                }, t.prototype.GetIsGiftSalePage = function (n) {
                    var t = this.$q.defer(), i = {id: n}, r = this.config.webapiUrl + "/SalePage/GetIsGiftSalePage";
                    return this.$http.post(r, i).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, t.prototype.GetSalePageViewList = function () {
                    var n = this.$q.defer(), t = this.config.webapiUrl + "/SalePage/GetSalePageViewList";
                    return this.$http.post(t, null).success(function (t) {
                        n.resolve(t.Data.SalepageLit)
                    }).error(n.reject), n.promise
                }, t.prototype.GetSalePageAdditionalInfo = function (t, i) {
                    var r = this.$q.defer(), u = this.config.webapiUrl + "/SalePageV2/GetSalePageAdditionalInfo/" + t + "/" + i + "?source=" + n.WebStore.Frontend.BE.UserClientTrack.UserClientTrackSourceTypeEnum.Web;
                    return this.$http.get(u).success(function (n) {
                        r.resolve(n.Data)
                    }).error(r.reject), r.promise
                }, t.prototype.GetSalePageDataByIds = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/salepage/GetSalepageDataByIds?ids=" + n;
                    return this.$http.get(i).success(function (n) {
                        t.resolve(n.SalepageList)
                    }).error(t.reject), t.promise
                }, t.prototype.GetShopShippingDetailList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Shop/GetShopShippingDetailList/" + n;
                    return this.$http.get(i).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n.Data) : t.reject()
                    }).error(t.reject), t.promise
                }, t.$inject = ["Mall.Config", "$q", "$http", "$filter"], t
            }();
            t.SalePageService = i;
            angular.module("NineYi.Mall.Services").service("SalePageService", i)
        })(i = t.Services || (t.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i
                }

                return n.prototype.GetSellingQtyListNew = function (n) {
                    var t = n.join(","), i = this.config.webapiUrl + "/ProductStock/GetSellingQtyListNew", r = {ids: t};
                    return this.$http.post(i, r)
                }, n.$inject = ["Mall.Config", "$q", "$http"], n
            }();
            n.ProductStockService = t;
            angular.module("NineYi.Mall.Services").service("ProductStockService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.TraceSalePageListCache = r
                }

                return n.prototype.InsertItem = function (n) {
                    var t = this, i = this.config.webapiUrl + "/TraceSalePageList/InsertItem/?salePageId=" + n, r = {salePageId: n};
                    return this.$http.post(i, r, {withCredentials: !0}).success(function () {
                        var n = t.TraceSalePageListCache.get("Count");
                        n && t.TraceSalePageListCache.put("Count", n + 1)
                    })
                }, n.prototype.DeleteItem = function (n) {
                    var t = this, i = this.config.webapiUrl + "/TraceSalePageList/DeleteItem/?salePageId=" + n, r = {salePageId: n};
                    return this.$http.post(i, r, {withCredentials: !0}).success(function () {
                        var n = t.TraceSalePageListCache.get("Count");
                        n && t.TraceSalePageListCache.put("Count", n - 1)
                    })
                }, n.prototype.GetCount = function () {
                    var i = this, n = this.$q.defer(), r = this.config.webapiUrl + "/TraceSalePageList/GetCount", t = this.TraceSalePageListCache.get("Count");
                    return t ? n.resolve(t) : this.$http.post(r, null, {withCredentials: !0}).success(function (t) {
                            i.TraceSalePageListCache.put("Count", t);
                            n.resolve(t)
                        }).error(n.reject), n.promise
                }, n.prototype.GetDataList = function () {
                    var n = this.$q.defer(), t = this.config.webapiUrl + "/TraceSalePageList/GetDataList";
                    return this.$http.post(t, null, {withCredentials: !0}).success(function (t) {
                        n.resolve(t.data)
                    }).error(n.reject), n.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "TraceSalePageListCache"], n
            }();
            n.TraceSalePageService = t;
            angular.module("NineYi.Mall.Services").factory("TraceSalePageListCache", ["$cacheFactory", function (n) {
                return n("TraceSalePageList")
            }]);
            angular.module("NineYi.Mall.Services").service("TraceSalePageService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$q = n;
                    this.$http = t;
                    this.WebApiFactory = i
                }

                return n.prototype.GetShopCategoryPromotionList = function (n, t) {
                    var i = this.$q.defer(), r = this.WebApiFactory.getWebApiUrl("/shopCategory/GetPromotionList/" + n + "/" + t);
                    return this.$http.get(r).success(function (n) {
                        i.resolve(n)
                    }).error(i.reject), i.promise
                }, n.prototype.GetSearchShopCategorySalePageResult = function (n, t, i, r, u, f) {
                    var e = this.$q.defer(), o = this.WebApiFactory.getWebApiUrl("/shopCategory/GetSalePageList/" + n + "/" + t + "?order=" + i + "&startIndex=" + r + "&maxCount=" + u + "&isCuratorable=" + f);
                    return this.$http.get(o).success(function (n) {
                        e.resolve(n)
                    }).error(e.reject), e.promise
                }, n.$inject = ["$q", "$http", "WebApiFactory"], n
            }();
            n.ShopCategoryService = t;
            angular.module("NineYi.Mall.Services").service("ShopCategoryService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.WebApiFactory = r
                }

                return n.prototype.GetActivityList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Activity/GetActivityList?shopId=" + n;
                    return this.$http.get(i).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n.Data) : t.reject(n.Message)
                    }).error(t.reject), t.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "WebApiFactory"], n
            }();
            n.ActivityService = t;
            angular.module("NineYi.Mall.Services").service("ActivityService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f, e) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.$log = r;
                    this.shopId = u;
                    this.$filter = f;
                    this.WebApiFactory = e
                }

                return n.prototype.GetInfoModule = function (n, t) {
                    for (var u = this.$q.defer(), e = this.config.webapiUrl + "/Official/GetInfoModule?shopId=" + n, f = {infoModuleClients: []}, r, i = 0; i < t.length; i++)r = t[i], f.infoModuleClients.push({
                        InfoModuleId: r.TargetInfo.TargetId,
                        InfoModuleType: r.TargetInfo.TargetType,
                        Order: r.Order
                    });
                    return this.$http.post(e, f).success(function (n) {
                        u.resolve(n)
                    }).error(u.reject), u.promise
                }, n.prototype.GetOfficialSalePageByCategory = function (n, t, i, r, u) {
                    var e = this, o = this.$q.defer(), f = this.config.webapiUrl + "/Official/GetOfficialSalePageByCategory";
                    return f += "?orderby=" + n, f += "&startIndex=" + t, f += "&maxCount=" + i, f += "&shopId=" + r, f += "&cid=" + u, this.$log.info("GetOfficialSalePageByCategory - start"), this.$http.get(f).success(function (n) {
                        if (n.Data && n.Data.PromotionList) {
                            var t = new Date;
                            n.Data.PromotionList = n.Data.PromotionList.filter(function (n) {
                                return e.$filter("nsDotNetDateParser")(n.StartTime) <= t
                            });
                            o.resolve(n);
                            e.$log.info("GetOfficialSalePageByCategory - success and finish")
                        }
                    }).error(function () {
                        e.$log.info("GetOfficialSalePageByCategory - fail");
                        o.reject()
                    }), o.promise
                }, n.prototype.GetOfficialBrandStoryPageHtml = function () {
                    var n = this.$q.defer(), t = this.config.webapiUrl + "/Official/GetOfficialBrandStoryPageHtml";
                    return this.$http.get(t, {}).success(function (t) {
                        n.resolve(t)
                    }).error(n.reject), n.promise
                }, n.prototype.GetOfficialNewestSalePage = function (n, t, i, r) {
                    var f = this.$q.defer(), u = this.config.webapiUrl + "/Official/GetOfficialNewestSalePage";
                    return u += "?orderby=" + n, u += "&startIndex=" + t, u += "&maxCount=" + i, u += "&shopId=" + r, this.$http.get(u, {}).success(function (n) {
                        f.resolve(n.Data)
                    }).error(f.reject), f.promise
                }, n.prototype.GetOfficialPromotionTargetList = function (n) {
                    var t = this.$q.defer(), i = this.WebApiFactory.getWebApiUrl("/Official/GetOfficialPromotionTargetList/" + n);
                    return this.$http.get(i).success(function (n) {
                        t.resolve(n.Data)
                    }).error(t.reject), t.promise
                }, n.prototype.GetAppDownLoadLink = function (n, t, i) {
                    i === void 0 && (i = "");
                    var r = this.$q.defer(), u = {shopId: n, cellPhone: t, pagefrom: i};
                    return this.$http.post("/webapi/Official/SendAppDownLoadLink", u).success(function (n) {
                        r.resolve(n)
                    }).error(r.reject), r.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "$log", "ShopId", "$filter", "WebApiFactory"], n
            }();
            n.OfficialService = t;
            angular.module("NineYi.Mall.Services").service("OfficialService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.shopId = r
                }

                return n.prototype.GetTraceSalePageIds = function (n) {
                    var t = this.config.webapiUrl + "/TraceSalePageList/GetTraceSalePageIds?shopId=" + n;
                    return this.$http.get(t)
                }, n.$inject = ["Mall.Config", "$q", "$http", "ShopId"], n
            }();
            n.TraceSalePageListService = t;
            angular.module("NineYi.Mall.Services").service("TraceSalePageListService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i
                }

                return n.prototype.GetShopSalePageTermListByKeyword = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Search/GetShopSalePageTermListByKeyword?keyword=" + encodeURIComponent(n), r = {keyword: encodeURIComponent(n)};
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopHotKeywordList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/SearchV2/GetShopHotKeywordList?shopId=" + n, r = {shopId: n};
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopPayTypeAndShippingTypeList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/SearchV2/GetShopPayTypeAndShippingTypeList?shopId=" + n, r = {shopId: n};
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopCategoryListBySearch = function (n, t, i, r, u, f, e, o) {
                    var h = this.$q.defer(), s = this.config.webapiUrl + "/SearchV2/GetShopCategoryListBySearch?shopId=" + n + "&keyword=" + encodeURIComponent(t), c = {
                        shopId: n,
                        keyword: encodeURIComponent(t),
                        minPrice: i,
                        maxPrice: r,
                        shippingType: u,
                        payType: f,
                        scoreThreshold: e
                    };
                    return s += "&minPrice=" + (i ? i : ""), s += "&maxPrice=" + (r ? r : ""), s += "&shippingType=" + (u ? u : ""), s += "&payType=" + (f ? f : ""), s += "&scoreThreshold=" + (!isNaN(e) && typeof e == "number" ? e : this.config.scoreThreshold), s += "&isResearch=" + !!o, this.$http.get(s, c).success(function (n) {
                        h.resolve(n)
                    }).error(h.reject), h.promise
                }, n.prototype.GetShopSalePageBySearch = function (n, t, i, r, u, f, e, o, s, h, c, l, a) {
                    var y = this.$q.defer(), v = this.config.webapiUrl + "/SearchV2/GetShopSalePageBySearch?shopId=" + n + "&keyword=" + encodeURIComponent(t), p = {
                        shopId: n,
                        keyword: encodeURIComponent(t),
                        minPrice: i,
                        maxPrice: r,
                        shippingType: u,
                        payType: f,
                        order: e,
                        startIndex: o,
                        maxCount: s,
                        displayScore: h,
                        shopCategoryId: c,
                        scoreThreshold: l
                    };
                    return v += "&minPrice=" + (!isNaN(i) && typeof i == "number" ? i : ""), v += "&maxPrice=" + (!isNaN(r) && typeof r == "number" ? r : ""), v += "&shippingType=" + (u ? u : ""), v += "&payType=" + (f ? f : ""), v += "&order=" + (e ? e : ""), v += "&startIndex=" + (o ? o : 0), v += "&maxCount=" + (s ? s : ""), v += "&displayScore=" + (h ? h : ""), v += "&shopCategoryId=" + (c ? c : ""), v += "&scoreThreshold=" + (!isNaN(l) && typeof l == "number" ? l : this.config.scoreThreshold), v += "&isResearch=" + !!a, this.$http.get(v, p).success(function (n) {
                        y.resolve(n)
                    }).error(y.reject), y.promise
                }, n.$inject = ["Mall.Config", "$q", "$http"], n
            }();
            n.SearchService = t;
            angular.module("NineYi.Mall.Services").service("SearchService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.WebApiFactory = r
                }

                return n.prototype.SetMemberECouponByCode = function (n, t) {
                    var i = this.$q.defer(), r = this.config.webapiUrl + "/ECoupon/SetMemberECouponByCode", u = {
                        code: n,
                        shopId: t
                    };
                    return this.$http.post(r, u, {withCredentials: !0}).success(function (n) {
                        n.ReturnCode === "API0001" ? i.resolve(n.Message) : i.reject(n.Message)
                    }).error(function () {
                        i.reject("目前網路不穩定,請再試一次 !")
                    }), i.promise
                }, n.prototype.GetMemberECouponList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ECoupon/GetMemberECouponList", r = {shopId: n};
                    return this.$http.post(i, r, {withCredentials: !0}).success(function (n) {
                        t.resolve(n.ECouponList)
                    }).error(t.reject), t.promise
                }, n.prototype.GetOfficialECouponList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ECoupon/GetOfficialECouponList?shopId=" + n, r = {shopId: n};
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n.ShopECouponList)
                    }).error(t.reject), t.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "WebApiFactory"], n
            }();
            n.ECouponService = t;
            angular.module("NineYi.Mall.Services").service("ECouponService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.WebApiFactory = r
                }

                return n.prototype.GetCouponList = function (n) {
                    var t = this.$q.defer(), i = this.WebApiFactory.getWebApiUrl("/Coupon/GetCouponList/" + n), r = {id: n};
                    if (!n) {
                        alert("請檢查您的網路狀態");
                        return
                    }
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n.data)
                    }).error(t.reject), t.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "WebApiFactory"], n
            }();
            n.CouponService = t;
            angular.module("NineYi.Mall.Services").service("CouponService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i
                }

                return n.prototype.GetList = function (n, t, i, r, u) {
                    var f = this.$q.defer(), e = this.config.webapiUrl + ("/PromotionV2/GetList/" + n + "?orderBy=" + t + "&startIndex=" + i + "&maxCount=" + r + "&typeDef=" + u);
                    return this.$http.get(e, {withCredentials: !0}).success(function (n) {
                        f.resolve(n)
                    }).error(f.reject), f.promise
                }, n.prototype.GetDetail = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/PromotionV2/GetDetail/" + n;
                    return this.$http.get(i, {withCredentials: !0}).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetSalePageList = function (n, t, i, r, u) {
                    var f = this.$q.defer(), e = this.config.webapiUrl + ("/PromotionV2/GetSalePageList/" + n + "/" + t + "?CategoryId=" + i + "&StartIndex=" + r + "&maxCount=" + u);
                    return this.$http.get(e, {withCredentials: !0}).success(function (n) {
                        f.resolve(n)
                    }).error(f.reject), f.promise
                }, n.prototype.Calculate = function (n, t, i) {
                    var r = this.$q.defer(), u = this.config.webapiUrl + "/PromotionV2/Calculate";
                    return this.$http.post(u, {
                        promotionDetailDiscount: JSON.stringify({
                            ShopId: n,
                            PromotionId: +t,
                            SalePageList: i
                        })
                    }, {withCredentials: !0}).success(function (n) {
                        r.resolve(n)
                    }).error(r.reject), r.promise
                }, n.$inject = ["Mall.Config", "$q", "$http"], n
            }();
            n.PromotionV2Service = t;
            angular.module("NineYi.Mall.Services").service("PromotionV2Service", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$q = n;
                    this.$http = t;
                    this.WebApiFactory = i
                }

                return n.prototype.GetHotSaleRankingList = function (n, t) {
                    var i = this.$q.defer(), r = this.WebApiFactory.getWebApiUrl("/HotSaleRanking/GetHotSaleRankingList/" + n + "?period=Weekly&maxCount=" + t);
                    return this.$http.get(r).success(function (n) {
                        i.resolve(n.data)
                    }).error(i.reject), i.promise
                }, n.$inject = ["$q", "$http", "WebApiFactory"], n
            }();
            n.HotSaleRankingService = t;
            angular.module("NineYi.Mall.Services").service("HotSaleRankingService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.ShopId = r;
                    this.WebApiFactory = u
                }

                return n.prototype.GetLayoutTemplateData = function (n) {
                    var t = this.config.webapiUrl + "/LayoutTemplateData/GetLayoutTemplateData?adCode=" + n;
                    return this.$http.get(t, {withCredentials: !0})
                }, n.prototype.GetLayoutTemplateDataByShopId = function (n, t) {
                    var i = this.config.webapiUrl + ("/LayoutTemplateData/GetLayoutTemplateData?adCode=" + n + "&shopId=" + t);
                    return this.$http.get(i, {withCredentials: !0})
                }, n.prototype.GetOfficialAllLayoutTemplateData = function (n) {
                    var t = this.config.webapiUrl + "/LayoutTemplateData/GetOfficialAllLayoutTemplateData?shopId=" + n, i = {shopId: n};
                    return this.$http.get(t, i)
                }, n.prototype.GetOfficialAllLayoutTemplateDataV2 = function (n) {
                    var t = this.$q.defer(), i = this.WebApiFactory.getWebApiUrl("/LayoutTemplateDataV2/GetOfficialAllLayoutTemplateData/" + n);
                    return this.$http.get(i, {withCredentials: !0}).success(function (n) {
                        if (n.ReturnCode === "API0001") {
                            var i = _.object(_.map(n.Data, _.values));
                            t.resolve(i)
                        } else t.reject(n.Message)
                    }).error(t.reject), t.promise
                }, n.prototype.GetOfficialCustomLinkV2 = function (n) {
                    var t = this.WebApiFactory.getWebApiUrl("/LayoutTemplateDataV2/GetOfficialCustomLink?shopId=" + n), i = {shopId: n};
                    return this.$http.get(t, i)
                }, n.$inject = ["Mall.Config", "$q", "$http", "ShopId", "WebApiFactory"], n
            }();
            n.LayoutTemplateDataService = t;
            angular.module("NineYi.Mall.Services").service("LayoutTemplateDataService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i
                }

                return n.prototype.IsLogin = function () {
                    var n = this.config.webapiUrl + "/Auth/IsLogin";
                    return this.$http.post(n, {withCredentials: !0})
                }, n.prototype.Logout = function () {
                    var n = this.config.webapiUrl + "/Auth/Logout";
                    return this.$http.get(n, {withCredentials: !0})
                }, n.prototype.GetInfo = function () {
                    var n = this.config.webapiUrl + "/Auth/GetInfo";
                    return this.$http.post(n, {withCredentials: !0})
                }, n.prototype.MergeMemberFavorites = function () {
                    var n = this.config.webapiUrl + "/Auth/MergeMemberFavorites";
                    return this.$http.post(n, {withCredentials: !0})
                }, n.$inject = ["Mall.Config", "$q", "$http"], n
            }();
            n.AuthService = t;
            angular.module("NineYi.Mall.Services").service("AuthService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.WebApiFactory = t;
                    this.$q = i;
                    this.$http = r
                }

                return n.prototype.GetShopShippingDetailList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Shop/GetShopShippingDetailList/" + n;
                    return this.$http.get(i).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n) : t.reject()
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopContractSetting = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Shop/GetShopContractSetting/" + n;
                    return this.$http.post(i, {}).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopCategoryList = function (n) {
                    var t = this.$q.defer(), i = this.WebApiFactory.getWebApiUrl("/Shop/GetShopCategoryListV2/" + n), r = {id: n};
                    return this.$http.get(i, r).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetProductCategoryList = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/Shop/GetShopCategoryListV3/" + n;
                    return this.$http.get(i).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShopAppName = function (n, t) {
                    var r = this, i = this.$q.defer(), u = this.WebApiFactory.getWebApiUrl("/Shop/GetShopAppName/" + n + "?osType=" + t), f = {
                        shopId: n,
                        osType: t
                    };
                    return this.$http.get(u, f).success(function (n) {
                        i.resolve(n);
                        r.AppName = n.Data.length > 0 && n.Data[0].appName ? n.Data[0].appName : ""
                    }).error(i.reject), i.promise
                }, n.$inject = ["Mall.Config", "WebApiFactory", "$q", "$http"], n
            }();
            n.ShopService = t;
            angular.module("NineYi.Mall.Services").service("ShopService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (t) {
            var i = function () {
                function t(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.WebApiFactory = r
                }

                return t.prototype.GetAllCategory = function () {
                    var t = this, n = this.$q.defer(), i = this.config.webapiUrl + "/Category/GetAll/";
                    return this.$http.get(i, {withCredentials: !0}).success(function (i) {
                        var r = t.JsonToCategoryModel(i.data);
                        n.resolve(r)
                    }).error(n.reject), n.promise
                }, t.prototype.JsonToCategoryModel = function (t) {
                    for (var f = [], i, r, u = 0; u < t.length; u++)i = t[u], r = new n.Models.CategoryModel, r.Id = i.Id, r.ParentId = i.ParentId, r.Name = i.Name, r.Sort = i.Sort, r.Level = i.Level, r.Note = i.Note, r.HighLight = i.HighLight, r.PUrl = i.PUrl, i.Data && i.Data.length > 0 && (r.Data = this.JsonToCategoryModel(i.Data)), f.push(r);
                    return f
                }, t.prototype.GetShopCategoryNavigation = function (n) {
                    var t = this.$q.defer(), i = this.WebApiFactory.getWebApiUrl("/Category/GetShopCategoryNavigation?categoryId=" + n);
                    return this.$http.get(i).success(function (n) {
                        t.resolve(n)
                    }).error(t.reject), t.promise
                }, t.$inject = ["Mall.Config", "$q", "$http", "WebApiFactory"], t
            }();
            t.CategoryService = i;
            angular.module("NineYi.Mall.Services").service("CategoryService", i)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.ShoppingCartCache = r
                }

                return n.prototype.Calculate = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ShoppingCartV3/Calculate", r = {
                        shoppingCart: angular.toJson(n),
                        isWeb: !0
                    };
                    return this.$http.post(i, r, {withCredentials: !0}).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n.Data) : t.reject(n.Message)
                    }).error(t.reject), t.promise
                }, n.prototype.GetCount = function (n) {
                    var r = this, t = this.$q.defer(), u = this.config.webapiUrl + "/ShoppingCartV2/GetCount", f = {shopId: n}, i = this.ShoppingCartCache.get("Count");
                    return i ? t.resolve(i) : this.$http.post(u, f, {withCredentials: !0}).success(function (n) {
                            r.ShoppingCartCache.put("Count", n);
                            t.resolve(n)
                        }).error(t.reject), t.promise
                }, n.prototype.GetPreview = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ShoppingCartV3/GetShoppingCartPreview", r = {shopId: n};
                    return this.$http.post(i, r, {withCredentials: !0}).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n.Data) : t.reject(n.Message)
                    }).error(t.reject), t.promise
                }, n.prototype.GetShoppingCart = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ShoppingCartV3/GetShoppingCart", r = {
                        shopId: n,
                        isWeb: !0
                    };
                    return this.$http.post(i, r, {withCredentials: !0}).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(n.Data) : t.reject(n.Message)
                    }).error(t.reject), t.promise
                }, n.prototype.UpdateShoppingCartQty = function (n) {
                    var t = this.$q.defer(), i = this.config.webapiUrl + "/ShoppingCartV3/UpdateShoppingCartQty", r = {qty: angular.toJson(n)};
                    return this.$http.post(i, r, {withCredentials: !0}).success(function (n) {
                        n.ReturnCode === "API0001" ? t.resolve(!0) : t.reject(n)
                    }).error(t.reject), t.promise
                }, n.prototype.RemoveItem = function (n, t, i, r) {
                    var u = this, f = this.config.webapiUrl + "/ShoppingCartV2/RemoveItem", e = {
                        shopId: n,
                        salePageId: t,
                        saleProductSKUId: i,
                        salePageSeq: r
                    };
                    return this.$http.post(f, e, {withCredentials: !0}).success(function () {
                        var n = u.ShoppingCartCache.get("Count");
                        n && u.ShoppingCartCache.put("Count", n - 1)
                    })
                }, n.prototype.InsertItem = function (n, t, i, r) {
                    var f = this, u = this.$q.defer(), e = this.config.webapiUrl + "/ShoppingCartV2/InsertItem", o = {
                        shopId: n,
                        salePageId: t,
                        saleProductSKUId: i,
                        qty: r
                    };
                    return this.$http.post(e, o, {withCredentials: !0}).then(function (n) {
                        if (n.data.ReturnCode === "API0002") {
                            u.reject(n.data.Message);
                            return
                        }
                        var t = f.ShoppingCartCache.get("Count");
                        t && f.ShoppingCartCache.put("Count", t + 1);
                        u.resolve()
                    }, u.reject), u.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "ShoppingCartCache"], n
            }();
            n.ShoppingCartService = t;
            angular.module("NineYi.Mall.Services").factory("ShoppingCartCache", ["$cacheFactory", function (n) {
                return n("ShoppingCart")
            }]);
            angular.module("NineYi.Mall.Services").service("ShoppingCartService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i
                }

                return n.prototype.GetList = function () {
                    var n = this.config.webapiUrl + "/TraceShopList/GetDataList";
                    return this.$http.post(n, {withCredentials: !0})
                }, n.$inject = ["Mall.Config", "$q", "$http"], n
            }();
            n.TraceShopService = t;
            angular.module("NineYi.Mall.Services").service("TraceShopService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.config = n;
                    this.$q = t;
                    this.$http = i;
                    this.WebApiFactory = r
                }

                return n.prototype.GetShopCategoryHotSaleRankingList = function (n, t) {
                    var i = this.$q.defer(), r = this.config.webapiUrl + "/ShopCategoryHotSaleRanking/GetShopCategoryHotSaleRankingList?shopId=" + n + "&shopCategoryId=" + t;
                    return this.$http.get(r).success(function (n) {
                        i.resolve(n.data)
                    }).error(function () {
                        i.reject()
                    }), i.promise
                }, n.$inject = ["Mall.Config", "$q", "$http", "WebApiFactory"], n
            }();
            n.ShopCategoryHotSaleService = t;
            angular.module("NineYi.Mall.Services").service("ShopCategoryHotSaleService", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n) {
                    this.$q = n
                }

                return n.prototype.CallPromiseAction = function (n) {
                    var t = this.$q.defer();
                    return n.then(function (n) {
                        t.resolve(n)
                    }), t.promise
                }, n.prototype.CallHttpPromiseAction = function (n) {
                    var t = this.$q.defer();
                    return n.success(function (n) {
                        t.resolve(n)
                    }), t.promise
                }, n.$inject = ["$q"], n
            }();
            n.BaseServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("BaseServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i) {
                    n.call(this, t);
                    this.$q = t;
                    this.AuthService = i;
                    this.IsLogin()
                }

                return __extends(t, n), t.prototype.IsLogin = function () {
                    var t = this;
                    this.IsLoginPromise = n.prototype.CallHttpPromiseAction.call(this, this.AuthService.IsLogin());
                    this.IsLoginPromise.then(function (n) {
                        t.AuthService.LoginStatus = n
                    })
                }, t.$inject = ["$q", "AuthService"], t
            }(n.BaseServiceImmediate);
            n.AuthServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("AuthServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r) {
                    n.call(this, t);
                    this.$q = t;
                    this.OfficialService = i;
                    this.ShopId = r;
                    this.GetOfficialPromotionTargetList()
                }

                return __extends(t, n), t.prototype.GetOfficialPromotionTargetList = function () {
                    this.GetOfficialPromotionTargetListPromise = n.prototype.CallPromiseAction.call(this, this.OfficialService.GetOfficialPromotionTargetList(this.ShopId))
                }, t.$inject = ["$q", "OfficialService", "ShopId"], t
            }(n.BaseServiceImmediate);
            n.OfficialServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("OfficialServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r, u) {
                    n.call(this, t);
                    this.$q = t;
                    this.$timeout = i;
                    this.shopId = r;
                    this.layoutTemplateDataService = u;
                    this.shopId > 0 && (this.GetAdList(), this.GetCustomLinks())
                }

                return __extends(t, n), t.prototype.GetAdList = function () {
                    var t = this;
                    this.GetAdListPromise = n.prototype.CallPromiseAction.call(this, this.layoutTemplateDataService.GetOfficialAllLayoutTemplateDataV2(this.shopId));
                    this.GetAdListPromise.then(function (n) {
                        n && (t.layoutTemplateDataService.AdList = n)
                    })
                }, t.prototype.GetCustomLinks = function () {
                    var t = this;
                    this.GetCustomLinkPromise = n.prototype.CallHttpPromiseAction.call(this, this.layoutTemplateDataService.GetOfficialCustomLinkV2(this.shopId));
                    this.GetCustomLinkPromise.then(function (n) {
                        n && (t.layoutTemplateDataService.OfficialCustomLink = n.Data)
                    })
                }, t.$inject = ["$q", "$timeout", "ShopId", "LayoutTemplateDataService"], t
            }(n.BaseServiceImmediate);
            n.LayoutTemplateDataServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("LayoutTemplateDataServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r) {
                    n.call(this, t);
                    this.$q = t;
                    this.TraceSalePageListService = i;
                    this.ShopId = r;
                    this.GetTraceSalePageIds()
                }

                return __extends(t, n), t.prototype.GetTraceSalePageIds = function () {
                    var i = this, t = this.$q.defer();
                    n.prototype.CallHttpPromiseAction.call(this, this.TraceSalePageListService.GetTraceSalePageIds(this.ShopId)).then(function (n) {
                        t.resolve(n.data)
                    });
                    this.GetTraceSalePageIdsPromise = t.promise;
                    this.GetTraceSalePageIdsPromise.then(function (n) {
                        i.TraceSalePageListService.TraceSalePageList = n
                    })
                }, t.$inject = ["$q", "TraceSalePageListService", "ShopId"], t
            }(n.BaseServiceImmediate);
            n.TraceSalePageListServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("TraceSalePageListServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r) {
                    n.call(this, t);
                    this.$q = t;
                    this.ShopService = i;
                    this.ShopId = r;
                    this.GetShopCategoryList()
                }

                return __extends(t, n), t.prototype.GetShopCategoryList = function () {
                    var t = this;
                    this.GetShopCategoryListPromise = n.prototype.CallPromiseAction.call(this, this.ShopService.GetShopCategoryList(this.ShopId));
                    this.GetShopCategoryListPromise.then(function (n) {
                        t.ShopService.ShopCategoryData = n
                    })
                }, t.$inject = ["$q", "ShopService", "ShopId"], t
            }(n.BaseServiceImmediate);
            n.ShopServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("ShopServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r, u) {
                    n.call(this, t);
                    this.$q = t;
                    this.$timeout = i;
                    this.shopId = r;
                    this.eCouponService = u;
                    this.GetOfficialECouponList()
                }

                return __extends(t, n), t.prototype.GetOfficialECouponList = function () {
                    var t = this;
                    this.GetOfficialECouponListPromise = n.prototype.CallPromiseAction.call(this, this.eCouponService.GetOfficialECouponList(this.shopId));
                    this.GetOfficialECouponListPromise.then(function (n) {
                        n[0] && n[0].ECouponList && n[0].ECouponList.length > 0 && (t.eCouponService.ECouponList = n)
                    })
                }, t.$inject = ["$q", "$timeout", "ShopId", "ECouponService"], t
            }(n.BaseServiceImmediate);
            n.ECouponServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("ECouponServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r, u) {
                    n.call(this, t);
                    this.$q = t;
                    this.$timeout = i;
                    this.shopId = r;
                    this.couponService = u;
                    this.GetCouponList()
                }

                return __extends(t, n), t.prototype.GetCouponList = function () {
                    var t = this;
                    this.GetCouponListPromise = n.prototype.CallPromiseAction.call(this, this.couponService.GetCouponList(this.shopId));
                    this.GetCouponListPromise.then(function (n) {
                        t.couponService.CouponList = n
                    })
                }, t.$inject = ["$q", "$timeout", "ShopId", "CouponService"], t
            }(n.BaseServiceImmediate);
            n.CouponServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("CouponServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r) {
                    n.call(this, t);
                    this.$q = t;
                    this.shopId = i;
                    this.promotionV2Service = r;
                    this.GetPromotionList()
                }

                return __extends(t, n), t.prototype.GetPromotionList = function () {
                    var t = this;
                    this.GetPromotionListPromise = n.prototype.CallPromiseAction.call(this, this.promotionV2Service.GetList(this.shopId, "Newest", 0, 30, "All"));
                    this.GetPromotionListPromise.then(function (n) {
                        t.promotionV2Service.PromotionList = n.Data
                    })
                }, t.$inject = ["$q", "ShopId", "PromotionV2Service"], t
            }(n.BaseServiceImmediate);
            n.PromotionV2ServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("PromotionV2ServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t(t, i, r) {
                    n.call(this, t);
                    this.$q = t;
                    this.shopId = i;
                    this.hotSaleRankingService = r;
                    this.GetHotSaleRankingList()
                }

                return __extends(t, n), t.prototype.GetHotSaleRankingList = function () {
                    var t = this;
                    this.GetHotSaleRankingListPromise = n.prototype.CallPromiseAction.call(this, this.hotSaleRankingService.GetHotSaleRankingList(this.shopId, 8));
                    this.GetHotSaleRankingListPromise.then(function (n) {
                        n && (t.hotSaleRankingService.HotSaleRankingList = n)
                    })
                }, t.$inject = ["$q", "ShopId", "HotSaleRankingService"], t
            }(n.BaseServiceImmediate);
            n.HotSaleRankingServiceImmediate = t;
            angular.module("NineYi.Mall.Services").service("HotSaleRankingServiceImmediate", t)
        })(t = n.Services || (n.Services = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$q = n;
                    this.$modal = t
                }

                return n.prototype.AddToCart = function (n, t, i, r, u) {
                    var f = this.$q.defer(), e = {
                        templateUrl: "/V2/TypeScripts/Utilities/ShoppingCartUtility/addToCart.html",
                        size: "lg",
                        windowClass: "add-to-cart-modal",
                        backdrop: !0,
                        keyboard: !1,
                        resolve: {
                            addToCartConfig: function () {
                                return {salePageId: n, shopId: t, chooseSkuItem: i, position: r, listName: u}
                            }
                        },
                        controller: "AddToShoppingCartController as AddToShoppingCartCtrl"
                    }, o = this.$modal.open(e);
                    return o.result.then(f.resolve, f.reject), f.promise
                }, n.prototype.AddToBasket = function (n, t, i, r) {
                    var u = this.$q.defer(), f = {
                        templateUrl: "/V2/TypeScripts/Utilities/ShoppingCartUtility/addToBasket.html",
                        size: "lg",
                        windowClass: "add-to-cart-modal",
                        backdrop: !0,
                        keyboard: !1,
                        resolve: {
                            addToCartConfig: function () {
                                return {salePageId: n, shopId: t, position: i, listName: r}
                            }
                        },
                        controller: "AddToBasketController as AddToBasketCtrl"
                    }, e = this.$modal.open(f);
                    return e.result.then(u.resolve, u.reject), u.promise
                }, n.prototype.AddToCartResult = function (n, t, i) {
                    var r = this.$q.defer(), u = {
                        templateUrl: "/V2/TypeScripts/Utilities/ShoppingCartUtility/addToCartResult.html",
                        size: "sm",
                        windowClass: "result-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            addToCartConfig: function () {
                                return {message: n, autoClose: t, isOK: i}
                            }
                        },
                        controller: "AddToShoppingCartController as AddToShoppingCartCtrl"
                    }, f = this.$modal.open(u);
                    return f.result.then(r.resolve, r.reject), r.promise
                }, n.$inject = ["$q", "$modal"], n
            }();
            n.ShoppingCartUtility = t;
            angular.module("NineYi.Mall.Utilities").service("ShoppingCartUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.prototype.getElementOffset = function (n) {
                    var i = document.documentElement, t = n.getBoundingClientRect(), r = t.top + window.pageYOffset - i.clientTop, u = t.left + window.pageXOffset - i.clientLeft, f = t.height;
                    return {top: r, left: u, height: f}
                }, n.prototype.GetOuterWidthWithMargin = function (n) {
                    var i = n.offsetWidth, t = getComputedStyle(n);
                    return i + (parseInt(t.marginLeft) + parseInt(t.marginRight))
                }, n.prototype.IsVisable = function (n) {
                    var t = n.getBoundingClientRect();
                    return t.bottom > 0 && t.right > 0 && t.left < (window.innerWidth || document.documentElement.clientWidth) && t.top < (window.innerHeight || document.documentElement.clientHeight)
                }, n.prototype.HasScrollBar = function (n) {
                    return n.scrollHeight > n.offsetHeight || n.scrollWidth > n.offsetWidth
                }, n.$inject = [], n
            }();
            n.ElementUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("ElementUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i, r) {
                    this.$modal = n;
                    this.$modalStack = t;
                    this.$log = i;
                    this.$q = r;
                    this.IsOpen = !1
                }

                return t.prototype.ShowDownloadLinkResult = function (t, i) {
                    if (this.IsOpen == !1) {
                        this.IsOpen = !0;
                        var r = this.$q.defer(), u = {
                            templateUrl: "/V2/TypeScripts/Utilities/AppDownloadUtility/AppDownload.html",
                            windowClass: "download-app-popup",
                            backdrop: !0,
                            size: "sm",
                            keyboard: !1,
                            controller: ["$scope", "QRCodeImageUrl", "DownloadAppUrl", "AppDownloadUtility", function (r, u, f, e) {
                                r.QRCodeImageUrl = u;
                                r.DownloadAppUrl = f;
                                r.PhoneNumber = n.Mall.Configs.RegexPattern.Phone.test(t) ? t.replace(t.substr(4, 4), "****") : t;
                                r.ReturnCode = i;
                                r.Cancel = function () {
                                    e.Cancel()
                                }
                            }]
                        };
                        return this.$modalInstance = this.$modal.open(u), this.$modalInstance.result.then(r.resolve, r.reject), r.promise
                    }
                }, t.prototype.Cancel = function () {
                    this.$modalStack.close(this.$modalInstance);
                    this.IsOpen = !1
                }, t.$inject = ["$modal", "$modalStack", "$log", "$q"], t
            }();
            t.AppDownloadUtility = i;
            angular.module("NineYi.Mall.Utilities").service("AppDownloadUtility", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.prototype.AddCookie = function (n, t, i) {
                    var u = "", r;
                    i && (r = new Date, r.setTime(r.getTime() + i * 864e5), u = "; expires=" + r.toUTCString());
                    document.cookie = n + "=" + t + u + "; path=/"
                }, n.prototype.DeleteCookie = function (n) {
                    this.AddCookie(n, "", -1)
                }, n.prototype.GetCookie = function (n) {
                    return (document.cookie.match("(^|; )" + n + "=([^;]*)") || 0)[2]
                }, n.prototype.SetCookieExpireTime = function (n, t) {
                    var i = this.GetCookie(n), r = new Date(Date.now() + (t || 0));
                    return i && (document.cookie = n + "=" + i + ";expires=" + r.toUTCString() + ";path=/;"), r.toUTCString()
                }, n
            }();
            n.CookieUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("CookieUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(t, i, r) {
                    this.AppVersionUtility = t;
                    this.DeviceValue = i;
                    this.$window = r;
                    this.GaSetting = this.$window.GoogleAnalyticsSettingData;
                    this.IsFromApp = this.AppVersionUtility.IsFromApp();
                    var u = this.DeviceValue.GetDeviceOS() === n.Mall.Models.DeviceOsEnum.Bot;
                    this.IsSetup = this.$window.ga && this.GaSetting && !this.IsFromApp && !u
                }

                return t.$inject = ["AppVersionUtility", "DeviceValue", "$window"], t
            }();
            t.GoogleAnalyticsConfig = i;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsConfig", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i, r, u, f) {
                    this.PageValue = n;
                    this.GoogleAnalyticsConfig = t;
                    this.$q = i;
                    this.$window = r;
                    this.AuthService = u;
                    this.AuthServiceImmediate = f;
                    this.UserInfo = {}
                }

                return t.prototype.SetDimension = function (t) {
                    var i = this, r = this.$q.defer();
                    return this.GoogleAnalyticsConfig.IsSetup && this.GetUserInfo().then(function () {
                        i.$window.ga((t || "") + "set", "userId", i.UserInfo.UserId);
                        i.$window.ga((t || "") + "set", "dimension1", i.UserInfo.UserId);
                        i.$window.ga((t || "") + "set", "dimension2", i.UserInfo.IdentityType);
                        i.PageValue.CurrentPage === n.Mall.Models.PageNameEnum.SalePageIndex && i.$window.ga((t || "") + "set", "dimension5", i.GetSalePageId());
                        r.resolve()
                    }), r.promise
                }, t.prototype.SetHitLevelDimension = function (n) {
                    var t = this, i = this.$q.defer();
                    return this.GoogleAnalyticsConfig.IsSetup && this.GetUserInfo().then(function () {
                        t.$window.ga((n || "") + "set", "dimension3", t.UserInfo.LoginStatus.toString());
                        var r = (t.UserInfo.UserId ? t.UserInfo.UserId : "") + "//" + t.UserInfo.IdentityType + "//" + t.UserInfo.LoginStatus;
                        t.$window.ga((n || "") + "set", "dimension4", r);
                        i.resolve()
                    }), i.promise
                }, t.prototype.GetUserInfo = function () {
                    var n = this, t = this.$q.defer(), i = this.UserInfo.UserId ? this.UserInfo.UserId : (document.cookie.match("(^|; )MID=([^;]*)") || 0)[2];
                    return i && typeof this.AuthService.LoginStatus != "undefined" ? (this.UserInfo.LoginStatus = +this.AuthService.LoginStatus, this.UserInfo.UserId = i, this.UserInfo.IdentityType = this.UserInfo.UserId ? "MID" : "gaClientId", t.resolve()) : this.AuthServiceImmediate.IsLoginPromise.then(function (i) {
                            n.UserInfo.LoginStatus = +i;
                            n.UserInfo.UserId = (document.cookie.match("(^|; )MID=([^;]*)") || 0)[2];
                            n.UserInfo.IdentityType = n.UserInfo.UserId ? "MID" : "gaClientId";
                            t.resolve()
                        }), t.promise
                }, t.prototype.GetSalePageId = function () {
                    var n = new RegExp("/salepage/index/", "ig");
                    return window.location.pathname.replace(n, "")
                }, t.$inject = ["PageValue", "GoogleAnalyticsConfig", "$q", "$window", "AuthService", "AuthServiceImmediate"], t
            }();
            t.GoogleAnalyticsCustomDataUtility = i;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsCustomDataUtility", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.pageValue = n;
                    this.urlUtility = t;
                    this.GaRefererName = "garefersrc"
                }

                return n.prototype.GetAppendReferUrl = function (n, t) {
                    var i = n.indexOf("?") === -1 ? "?" : "&";
                    return n + i + this.GaRefererName + "=" + t
                }, n.prototype.GetListName = function () {
                    var n = "", t = this.urlUtility.GetQuerystring(this.GaRefererName);
                    switch (t) {
                        case"TopViewAlsoView":
                            n = "推薦商品-商品頁TOP-ViewAlsoView";
                            break;
                        case"DownViewAlsoView":
                            n = "推薦商品-商品頁DOWN-ViewAlsoView";
                            break;
                        case"HotsaleInCategory":
                            n = "分類熱賣-商品頁";
                            break;
                        case"HotsaleOverall":
                            n = "全站熱銷排行-商品頁";
                            break;
                        case"BrowseHistory":
                            n = "瀏覽紀錄商品";
                            break;
                        default:
                            n = this.pageValue.PreviousPageName
                    }
                    return n
                }, n.$inject = ["PageValue", "UrlUtility"], n
            }();
            n.GoogleAnalyticsRefererUtility = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsRefererUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.GoogleAnalyticsConfig = n;
                    this.GoogleAnalyticsCustomDataUtility = t;
                    this.$q = i;
                    this.$window = r;
                    this.config = u;
                    this.GoogleAnalyticsConfig.IsSetup && (this.ClientId = this.GetClientId(), this.InitGoogleAnalytics(this.GoogleAnalyticsConfig.GaSetting.GoogleAnalyticsTrackingId))
                }

                return n.prototype.InitGoogleAnalytics = function (n, t) {
                    var r = this, i = {
                        cookieDomain: "auto",
                        allowLinker: !0,
                        alwaysSendReferrer: !0,
                        storage: "none",
                        clientId: this.ClientId
                    };
                    t && (i.name = t.split(".")[0]);
                    this.$window.ga("create", n, i);
                    this.GoogleAnalyticsCustomDataUtility.SetDimension(t).then(function () {
                        r.SendPageView(t)
                    });
                    this.$window.ga((t || "") + "require", "ec");
                    this.$window.ga((t || "") + "require", "linker");
                    this.$window.ga((t || "") + "linker:autoLink", [this.GoogleAnalyticsConfig.GaSetting.originDomain !== "" ? this.GoogleAnalyticsConfig.GaSetting.originDomain : this.GoogleAnalyticsConfig.GaSetting.officialSsoDomain]);
                    this.$window.ga((t || "") + "require", "displayfeatures");
                    this.config.trackServiceEnable && (this.config.env !== "prod" ? this.$window.ga((t || "") + "require", "trackserviceplugin") : Math.random() <= .5 && this.$window.ga((t || "") + "require", "trackserviceplugin"))
                }, n.prototype.TrackPageUseOptional = function (n, t) {
                    this.GoogleAnalyticsConfig.IsSetup && (this.SetPageAndTitle(n, t), this.SendPageView())
                }, n.prototype.TrackEvent = function (n, t, i, r) {
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        var u = [this.SendTrackEvent(n, t, i, r),];
                        return this.$q.all(u)
                    }
                }, n.prototype.hitCallBack = function (n) {
                    n.resolve()
                }, n.prototype.SendTrackEvent = function (n, t, i, r, u) {
                    var f = this, e = this.$q.defer();
                    return this.GoogleAnalyticsCustomDataUtility.SetHitLevelDimension(u).then(function () {
                        var o = {
                            hitType: "event",
                            eventCategory: n,
                            eventAction: t,
                            eventLabel: i,
                            eventValue: r,
                            hitCallback: f.hitCallBack(e)
                        };
                        f.$window.ga((u || "") + "send", o)
                    }), e.promise
                }, n.prototype.SendPageView = function (n) {
                    var t = this;
                    this.GoogleAnalyticsCustomDataUtility.SetHitLevelDimension(n).then(function () {
                        t.$window.ga((n || "") + "send", "pageview")
                    })
                }, n.prototype.SetPageAndTitle = function (n, t, i) {
                    this.$window.ga((i || "") + "set", {page: n, title: t})
                }, n.prototype.GenerateGuid = function () {
                    function n() {
                        return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1)
                    }

                    return (n() + n() + "-" + n() + "-4" + n().substr(0, 3) + "-" + n() + "-" + n() + n() + n()).toLowerCase()
                }, n.prototype.GetClientId = function () {
                    var n = (document.cookie.match("(^|; )gaClientId=([^;]*)") || 0)[2], t, i, r;
                    return n || (n = this.GenerateGuid(), t = new Date, i = 731, t.setTime(t.getTime() + i * 864e5), r = "; expires=" + t.toUTCString(), document.cookie = "gaClientId=" + n + r + "; path=/"), n
                }, n.$inject = ["GoogleAnalyticsConfig", "GoogleAnalyticsCustomDataUtility", "$q", "$window", "Mall.Config"], n
            }();
            n.GoogleAnalyticsUtility = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    this.GoogleAnalyticsUtility = n;
                    this.GoogleAnalyticsConfig = t;
                    this.$window = i;
                    this.$q = r
                }

                return n.prototype.SendImpression = function (n, t) {
                    var f = this, r;
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        t = t ? t : "";
                        var i = angular.copy(n), e = i.length > 10 ? Math.ceil(i.length / 10) : 1, u = [];
                        for (r = 0; r <= e - 1; r++)u = i.splice(0, 10), u.map(function (n) {
                            f.$window.ga((t || "") + "ec:addImpression", n)
                        });
                        this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "scroll", "Product Impression", null, t)
                    }
                }, n.prototype.SendProductClicks = function (n, t, i) {
                    var r = this.$q.defer();
                    return this.AddProduct(n, i), this.$window.ga((i || "") + "ec:setAction", "click", {list: t}), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "click", "Product Clicks", null, i).then(function () {
                        r.resolve()
                    }), r.promise
                }, n.prototype.SendProductDetails = function (n, t, i) {
                    var r = this.$q.defer();
                    return this.AddProduct(n, i), this.$window.ga((i || "") + "ec:setAction", "detail", {list: t}), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "click", "Product Details", null, i).then(function () {
                        r.resolve()
                    }), r.promise
                }, n.prototype.SendAddToCart = function (n, t) {
                    var i = this.$q.defer();
                    return this.AddProduct(n, t), this.$window.ga((t || "") + "ec:setAction", "add"), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "click", "Add To Cart", null, t).then(function () {
                        i.resolve()
                    }), i.promise
                }, n.prototype.SendRemoveFromCart = function (n, t) {
                    var i = this.$q.defer();
                    return this.AddProduct(n, t), this.$window.ga((t || "") + "ec:setAction", "remove"), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "click", "Remove From Cart", null, t).then(function () {
                        i.resolve()
                    }), i.promise
                }, n.prototype.SendCheckout = function (n, t, i, r) {
                    var f = this, u = this.$q.defer();
                    return n.map(function (n) {
                        f.AddProduct(n, r)
                    }), this.$window.ga((r || "") + "ec:setAction", "checkout", {
                        step: t,
                        option: i
                    }), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "click", "Checkout - Step" + t, null, r).then(function () {
                        u.resolve()
                    }), u.promise
                }, n.prototype.SendPurchase = function (n, t, i, r, u, f, e) {
                    var s = this, o = this.$q.defer();
                    return u.map(function (n) {
                        s.AddProduct(n, e)
                    }), this.$window.ga((e || "") + "ec:setAction", "purchase", {
                        id: n,
                        affiliation: t,
                        revenue: i,
                        shipping: r,
                        coupon: f
                    }), this.GoogleAnalyticsUtility.SendTrackEvent("ECommerce", "Purchase", n, null, e).then(function () {
                        o.resolve()
                    }), o.promise
                }, n.prototype.AddProduct = function (n, t) {
                    this.GoogleAnalyticsConfig.IsSetup && this.$window.ga((t || "") + "ec:addProduct", n)
                }, n.$inject = ["GoogleAnalyticsUtility", "GoogleAnalyticsConfig", "$window", "$q"], n
            }();
            n.GoogleAnalyticsEcommerceCommand = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsEcommerceCommand", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n) {
                    this.$window = n;
                    this.DataLayer = this.$window.dataLayer || []
                }

                return n.prototype.ProductImpression = function (n) {
                    var i, t, r;
                    if (this.DataLayer)for (i = n.length > 10 ? Math.ceil(n.length / 10) : 1, t = 0; t <= i - 1; t++)r = n.splice(0, 10), this.DataLayer.push({
                        event: "gtm.gaEnhance.productImpression",
                        ecommerce: {currencyCode: "TWD", impressions: r}
                    })
                }, n.prototype.Checkout = function (n, t, i) {
                    var r = this;
                    setTimeout(function () {
                        r.DataLayer && r.DataLayer.push({
                            event: "gtm.gaEnhance.checkout",
                            ecommerce: {checkout: {actionField: {step: t, option: i}, products: n}}
                        })
                    }, 0)
                }, n.prototype.Purchase = function (n, t, i, r, u, f) {
                    var e = this;
                    this.DataLayer && setTimeout(function () {
                        e.DataLayer.push({
                            event: "gtm.gaEnhance.purchase",
                            ecommerce: {
                                purchase: {
                                    actionField: {
                                        id: n,
                                        affiliation: t,
                                        revenue: i,
                                        shipping: r,
                                        coupon: f
                                    }, products: u
                                }
                            }
                        })
                    }, 0)
                }, n.prototype.OrderDetail = function (n) {
                    this.DataLayer && this.DataLayer.push({event: "gtm.orderCompleted", transactionTotal: n})
                }, n.prototype.AddToCart = function (n, t, i) {
                    this.DataLayer && this.DataLayer.push({
                        event: "gtm.addToCart",
                        google_tag_params_addtocart: {dynx_itemid: n, dynx_quantity: t, dynx_price: i}
                    })
                }, n.prototype.ProductDetail = function (n) {
                    this.DataLayer && (this.DataLayer.push({
                        google_tag_params: {
                            dynx_itemid: n.Id,
                            dynx_itemtitle: n.Title,
                            dynx_finalurl: n.PageUrl,
                            dynx_imageurl: n.MainImage,
                            dynx_itemsubtitle: n.ShopName,
                            dynx_itemdescription: n.Desc,
                            dynx_itemcategory: n.Category,
                            dynx_price: n.SuggestPrice + " TWD",
                            dynx_saleprice: n.Price + " TWD",
                            dynx_contextualkeyword: n.Keyword,
                            dynx_pagetype: "offerdetail"
                        }
                    }), this.DataLayer.push({google_tag_params_product: this.GetGoogleTagParamsProduct(n)}))
                }, n.prototype.Category = function (n, t) {
                    this.DataLayer && this.DataLayer.push({fullcategory: n, shopname: t})
                }, n.prototype.CategoryProduct = function (n) {
                    this.DataLayer && this.DataLayer.push({dynx_productids: n})
                }, n.prototype.ProductCheckOut = function (n) {
                    var i = this, t;
                    this.DataLayer && (t = [], n.map(function (n) {
                        t.push(i.GetGoogleTagParamsProduct(n))
                    }), this.DataLayer.push({google_tag_params_products: t}))
                }, n.prototype.ProductPurchase = function (n) {
                    var i = this, t;
                    this.DataLayer && (t = [], n.Products.map(function (n) {
                        t.push(i.GetGoogleTagParamsProduct(n))
                    }), this.DataLayer.push({
                        google_tag_params_order: {
                            dynx_orderproducts: t,
                            dynx_ordercurrency: n.Currency,
                            dynx_ordertotalprice: n.TotalPrice,
                            dynx_orderid: n.Id
                        }
                    }))
                }, n.prototype.SearchSubmit = function (n, t) {
                    this.DataLayer && this.DataLayer.push({dynx_searchwords: n, dynx_searchproductids: t})
                }, n.prototype.GetGoogleTagParamsProduct = function (n) {
                    return {
                        dynx_itemid: n.Id,
                        dynx_itemtitle: n.Title,
                        dynx_finalurl: n.PageUrl,
                        dynx_imageurl: n.MainImage,
                        dynx_itemsubtitle: n.ShopName,
                        dynx_itemdescription: n.Desc,
                        dynx_itemcategory: n.Category,
                        dynx_price: n.SuggestPrice,
                        dynx_saleprice: n.Price,
                        dynx_contextualkeyword: n.Keyword,
                        dynx_pagetype: "offerdetail",
                        dynx_quantity: n.Quantity,
                        dynx_fullcategory: n.FullCategory,
                        dynx_currency: n.Currency,
                        dynx_valid: n.Valid
                    }
                }, n.$inject = ["$window"], n
            }();
            n.GoogleTagManagerDataLayerUtility = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleTagManagerDataLayerUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.GoogleAnalyticsEcommerceCommand = n;
                    this.GoogleTagManagerDataLayerUtility = t;
                    this.GoogleAnalyticsConfig = i;
                    this.$window = r;
                    this.$q = u
                }

                return n.prototype.ProductImpression = function (n) {
                    this.GoogleAnalyticsEcommerceCommand.SendImpression(n);
                    this.GoogleTagManagerDataLayerUtility.ProductImpression(n)
                }, n.prototype.ProductClicks = function (n, t) {
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        var i = [this.GoogleAnalyticsEcommerceCommand.SendProductClicks(n, t),];
                        return this.$q.all(i)
                    }
                }, n.prototype.ProductDetails = function (n, t) {
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        var i = [this.GoogleAnalyticsEcommerceCommand.SendProductDetails(n, t),];
                        return this.$q.all(i)
                    }
                }, n.prototype.AddToCart = function (n) {
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        var t = [this.GoogleAnalyticsEcommerceCommand.SendAddToCart(n),];
                        return this.$q.all(t)
                    }
                }, n.prototype.RemoveFromCart = function (n) {
                    if (this.GoogleAnalyticsConfig.IsSetup) {
                        var t = [this.GoogleAnalyticsEcommerceCommand.SendRemoveFromCart(n),];
                        return this.$q.all(t)
                    }
                }, n.prototype.ProductClickWithDetail = function (n, t) {
                    var i = this;
                    this.GoogleAnalyticsConfig.IsSetup && this.ProductClicks(n, t).then(function () {
                        i.ProductDetails(n, t)
                    })
                }, n.prototype.AddToCartDirect = function (n, t) {
                    var i = this;
                    this.GoogleAnalyticsConfig.IsSetup && this.ProductClicks(n, t).then(function () {
                        i.AddToCart(n)
                    })
                }, n.prototype.Checkout = function (n, t, i) {
                    var r = this;
                    setTimeout(function () {
                        r.GoogleAnalyticsConfig.IsSetup && r.GoogleAnalyticsEcommerceCommand.SendCheckout(n, t, i);
                        r.GoogleTagManagerDataLayerUtility.Checkout(n, t, i)
                    }, 0)
                }, n.prototype.Purchase = function (n, t, i, r, u, f) {
                    var e = this;
                    setTimeout(function () {
                        e.GoogleAnalyticsConfig.IsSetup && e.GoogleAnalyticsEcommerceCommand.SendPurchase(n, t, i, r, u, f);
                        e.GoogleTagManagerDataLayerUtility.Purchase(n, t, i, r, u, f)
                    }, 0)
                }, n.$inject = ["GoogleAnalyticsEcommerceCommand", "GoogleTagManagerDataLayerUtility", "GoogleAnalyticsConfig", "$window", "$q"], n
            }();
            n.GoogleAnalyticsEcommerceUtility = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleAnalyticsEcommerceUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n) {
                    this.$window = n
                }

                return n.prototype.TrackConversion = function (n, t, i) {
                    this.$window.google_trackConversion && this.$window.google_trackConversion({
                        google_conversion_id: n,
                        google_conversion_label: t,
                        google_conversion_value: i,
                        google_conversion_format: "3",
                        google_conversion_color: "ffffff",
                        google_conversion_currency: "TWD",
                        google_remarketing_only: !1
                    })
                }, n.prototype.TrackCustomRemarketing = function (n, t) {
                    window.google_trackConversion({
                        google_conversion_id: n,
                        google_custom_params: t,
                        google_remarketing_only: !0
                    })
                }, n.prototype.TrackProductDetail = function () {
                }, n.$inject = ["$window"], n
            }();
            n.GoogleAdwordsUtility = t;
            angular.module("NineYi.Mall.Utilities").service("GoogleAdwordsUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.prototype.FacebookCompleteRegistrationEvent = function (n) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "CompleteRegistration", {status: n})
                }, n.prototype.FacebookInitiateCheckoutEvent = function (n, t, i, r, u) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "InitiateCheckout", {
                        value: r,
                        currency: "TWD",
                        content_category: i,
                        content_name: n,
                        content_ids: t,
                        content_type: "product",
                        num_items: u
                    })
                }, n.prototype.FacebookAddPaymentInfoEvent = function (n, t, i) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "AddPaymentInfo", {
                        value: i,
                        currency: "TWD",
                        content_category: t,
                        content_ids: n,
                        content_type: "product"
                    })
                }, n.prototype.FacebookPurchaseEvent = function (n, t, i, r, u) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "Purchase", {
                        value: i,
                        currency: "TWD",
                        content_name: n,
                        content_type: "product",
                        content_ids: t,
                        num_items: r,
                        Order_id: u
                    })
                }, n.prototype.TrackSearchEvent = function (n) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "Search", {search_string: n})
                }, n.prototype.InitFacebook = function () {
                    var t, n;
                    if (window.fbq && window.FbCustomAudiencesPixelIds) {
                        for (t = window.FbCustomAudiencesPixelIds, n = 0; n <= t.length - 1; n++)window.fbq("init", t[n]);
                        window.fbq("track", "PageView")
                    }
                }, n.prototype.TrackAddToCartEvent = function (n, t, i, r) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "AddToCart", {
                        content_name: r,
                        content_category: t,
                        content_ids: n,
                        content_type: "Product",
                        value: i,
                        currency: "TWD"
                    })
                }, n.prototype.TrackLeadEvent = function (n, t, i, r) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "Lead", {
                        content_category: n,
                        content_name: t,
                        currency: i,
                        value: r
                    })
                }, n.prototype.TrackViewContentEvent = function (n, t, i, r) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "ViewContent", {
                        content_name: r,
                        content_ids: n,
                        content_type: "Product",
                        currency: "TWD",
                        value: i,
                        content_category: t
                    })
                }, n.prototype.TrackAddToWishlist = function (n, t, i, r) {
                    window.fbq && window.FbCustomAudiencesPixelIds && window.fbq("track", "AddToWishlist", {
                        content_name: r,
                        content_category: t,
                        content_ids: n,
                        content_type: "Product",
                        value: i,
                        currency: "TWD"
                    })
                }, n
            }();
            n.FacebookUtility = t;
            angular.module("NineYi.Mall.Utilities").service("FacebookUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$rootScope = n;
                    this.$log = t;
                    this.cfpLoadingBar = i
                }

                return n.prototype.EnableLoadingBar = function () {
                    var n = this;
                    this.$log.info("Enable Loading Bar");
                    this.$rootScope.IsStillLoading = !0;
                    this.$rootScope.$on("loadingBar:start", function () {
                        n.cfpLoadingBar.start()
                    });
                    this.$rootScope.$on("loadingBar:finish", function () {
                        n.$rootScope.IsStillLoading = !1;
                        n.cfpLoadingBar.complete()
                    })
                }, n.prototype.ShowLoadingBar = function () {
                    this.$log.debug("Show loading bar - Start");
                    this.$rootScope.$emit("loadingBar:start")
                }, n.prototype.HideLoadingBar = function () {
                    this.$log.debug("Show loading bar - Finish");
                    this.$rootScope.$emit("loadingBar:finish")
                }, n.$inject = ["$rootScope", "$log", "cfpLoadingBar"], n
            }();
            n.LoadingBarUtility = t;
            angular.module("NineYi.Mall.Utilities").service("LoadingBarUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                    var n = navigator.userAgent;
                    this.IsFirefox = n.indexOf("Firefox") !== -1;
                    this.IsOpera = n.indexOf("Opera") !== -1;
                    this.IsChrome = n.indexOf("Chrome") !== -1;
                    this.IsSafari = n.indexOf("Safari") !== -1 && !this.IsChrome;
                    this.IsWebkit = n.indexOf("WebKit") !== -1;
                    this.IsIE = n.indexOf("Trident") > 0 || n.indexOf("MSIE") > 0;
                    this.IsIE6 = n.indexOf("MSIE 6") > 0;
                    this.IsIE7 = n.indexOf("MSIE 7") > 0;
                    this.IsIE8 = n.indexOf("MSIE 8") > 0;
                    this.IsIE9 = n.indexOf("MSIE 9") > 0;
                    this.IsIE10 = n.indexOf("MSIE 10") > 0;
                    this.IsIE9_lower = this.IsIE6 || this.IsIE7 || this.IsIE8;
                    this.IsIE11_upper = n.indexOf("MSIE") === -1 && n.indexOf("Trident") > 0;
                    this.IsIE10_upper = this.IsIE10 || this.IsIE11_upper;
                    this.IsIE9_upper = this.IsIE9 || this.IsIE10_upper
                }

                return n.prototype.GetIsMobileBrowser = function () {
                    var n = !1;
                    return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (n = !0), n
                }, n
            }();
            n.UserAgentUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("UserAgentUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.prototype.GetQuerystring = function (n, t) {
                    try {
                        var i = RegExp("[?&]" + n + "=([^&]*)").exec(t ? t : document.location.search);
                        return i && decodeURIComponent(decodeURIComponent(i[1].replace(/\+/g, " ")))
                    } catch (r) {
                        return null
                    }
                }, n.prototype.GetHashstring = function (n) {
                    try {
                        var i = decodeURIComponent(document.location.hash), t = RegExp("[#&]" + n + "=([^&]*)").exec(i);
                        return t && decodeURIComponent(t[1].replace(/\+/g, " "))
                    } catch (r) {
                        return null
                    }
                }, n.prototype.AppendParameter = function (n, t, i, r) {
                    var s, e, f;
                    r === void 0 && (r = !1);
                    var h = "", c = n.length;
                    n.indexOf("#") > 0 && (c = n.indexOf("#"), h = n.substring(n.indexOf("#"), n.length));
                    var l = n.substring(0, c), o = l.split("?"), u = "";
                    if (o.length > 1)for (s = o[1].split("&"), e = 0; e < s.length; e++)f = s[e].split("="), !0 && f[0] == t || (u == "" ? u = "?" : u += "&", u += f[0] + "=" + (f[1] ? f[1] : ""));
                    return u == "" && (u = "?"), r ? u = "?" + t + "=" + i + (u.length > 1 ? "&" + u.substring(1) : "") : (u !== "" && u != "?" && (u += "&"), u += t + "=" + (i ? i : "")), o[0] + u + h
                }, n.prototype.JsonToQueryString = function (n) {
                    var i = [], t;
                    for (t in n)n[t] && n[t] !== "" && i.push(t + "=" + n[t]);
                    return "?" + i.join("&")
                }, n.prototype.RemoveQueryStringParam = function (n, t) {
                    var u = t.split("?")[0], f, i = [], e = t.indexOf("?") !== -1 ? t.split("?")[1] : "", r;
                    if (e !== "") {
                        for (i = e.split("&"), r = i.length - 1; r >= 0; r -= 1)f = i[r].split("=")[0], f === n && i.splice(r, 1);
                        u = u + "?" + i.join("&")
                    }
                    return u
                }, n
            }();
            n.UrlUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("UrlUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i) {
                    this.ShopId = n;
                    this.UrlUtility = t;
                    this.$window = i
                }

                return t.prototype.ReplaceRefUrl = function (t) {
                    var f = this.$window.location.origin + "/ref/" + this.ShopId + "/", r = "", i = "", u = !1;
                    switch (t) {
                        case n.Mall.Models.PageNameEnum.OfficailIndex:
                            i = "ShopHome";
                            r = i + "/" + this.ShopId;
                            break;
                        case n.Mall.Models.PageNameEnum.SalePageIndex:
                            i = "SalePage";
                            r = this.GetPageIdentityPath(i, new RegExp("/salepage/index/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.SalePageCategory:
                            i = "ShopSalePageCategory";
                            r = this.GetPageIdentityPath(i, new RegExp("/v2/official/SalePageCategory/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.CouponDetail:
                            i = "Coupon";
                            r = this.GetPageIdentityPath(i, new RegExp("/Coupon/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.CouponList:
                            i = "Couponlist";
                            r = i;
                            break;
                        case n.Mall.Models.PageNameEnum.VideoDetail:
                            i = "Video";
                            r = this.GetPageIdentityPath(i, new RegExp("/Video/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.ArticleDetail:
                            i = "Article";
                            r = this.GetPageIdentityPath(i, new RegExp("/Article/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.AlbumDetail:
                            i = "Album";
                            r = this.GetPageIdentityPath(i, new RegExp("/Album/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.VideoList:
                            i = "VideoList";
                            r = i;
                            break;
                        case n.Mall.Models.PageNameEnum.ArticleList:
                            i = "ArticleList";
                            r = i;
                            break;
                        case n.Mall.Models.PageNameEnum.AlbumList:
                            i = "AlbumList";
                            r = i;
                            break;
                        case n.Mall.Models.PageNameEnum.ECouponDetail:
                            i = "eCoupon";
                            r = this.GetPageIdentityPath(i, new RegExp("/ECoupon/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.ECouponList:
                            i = "eCouponList";
                            r = i;
                            break;
                        case n.Mall.Models.PageNameEnum.PromotionDetail:
                            i = "promotion";
                            r = this.GetPageIdentityPath(i, new RegExp("/Promotion/Detail/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.ActivityIndex:
                            i = "activity";
                            r = this.GetPageIdentityPath(i, new RegExp("/v2/activity/", "ig"));
                            break;
                        case n.Mall.Models.PageNameEnum.ShopStoreList:
                            i = "LocationList";
                            r = i;
                            break;
                        default:
                            i = "ShopHome";
                            r = i + "/" + this.ShopId;
                            u = !0
                    }
                    return f + r + this.GetUtmQueryString(i, u)
                }, t.prototype.GetUtmQueryString = function (n, t) {
                    var i = this.UrlUtility.GetQuerystring("utm_source"), r = this.UrlUtility.GetQuerystring("utm_medium"), u = this.UrlUtility.GetQuerystring("utm_campaign");
                    return i = i ? i : "mweb", r = r ? r : "download_banner", u = u ? u : t ? "others" : n, "?utm_source=" + i + "&utm_medium=" + r + "&utm_campaign=" + u
                }, t.prototype.GetPageIdentityPath = function (n, t) {
                    return n + "/" + this.$window.location.pathname.replace(t, "")
                }, t.$inject = ["ShopId", "UrlUtility", "$window"], t
            }();
            t.RefUtility = i;
            angular.module("NineYi.Mall.Utilities").service("RefUtility", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r) {
                    var u = this;
                    this.$scope = n;
                    this.$modalInstance = t;
                    this.config = i;
                    this.$timeout = r;
                    this.$scope.Message = this.config.UseNewLine ? this.config.Message.replace(/\\n/g, "\n") : this.config.Message;
                    this.$scope.ShowCancel = this.config.ShowCancel;
                    this.$scope.ConfirmTitle = this.config.ConfirmTitle;
                    this.$scope.CancelTitle = this.config.CancelTitle;
                    this.$scope.ShowClose = this.config.ShowClose || !1;
                    this.$scope.ShowOk = this.config.ShowOk || !0;
                    this.$scope.AutoClose = this.config.AutoClose || !1;
                    this.$scope.UseNewLine = this.config.UseNewLine || !1;
                    this.$scope.AutoClose && (this.$scope.ShowOk = !1, this.$timeout(function () {
                        u.Ok()
                    }, 750))
                }

                return n.prototype.Ok = function () {
                    this.$modalInstance.close("ok")
                }, n.prototype.Cancel = function () {
                    this.$modalInstance.dismiss("cancel")
                }, n.prototype.Close = function () {
                    this.$modalInstance.dismiss("close")
                }, n.$inject = ["$scope", "$modalInstance", "dialogConfig", "$timeout"], n
            }();
            n.DialogController = t;
            angular.module("NineYi.Mall.Utilities").controller("DialogController", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$scope = n;
                    this.$modalInstance = t;
                    this.dialogCustomizeConfig = i;
                    this.$scope.Title = this.dialogCustomizeConfig.Title;
                    this.$scope.Model = this.dialogCustomizeConfig.Model
                }

                return n.prototype.Ok = function () {
                    this.$modalInstance.close("ok")
                }, n.prototype.Cancel = function () {
                    this.$modalInstance.dismiss("cancel")
                }, n.prototype.Close = function () {
                    this.$modalInstance.dismiss("close")
                }, n.$inject = ["$scope", "$modalInstance", "DialogCustomizeConfig"], n
            }();
            n.DialogCustomizeController = t;
            angular.module("NineYi.Mall.Utilities").controller("DialogCustomizeController", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$q = n;
                    this.$modal = t
                }

                return n.prototype.Notice = function (n, t, i) {
                    t === void 0 && (t = "確認");
                    var r = this.$q.defer(), u = {
                        templateUrl: "/V2/TypeScripts/Utilities/DialogUtility/confirm.html",
                        size: "sm",
                        windowClass: "confirm-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            dialogConfig: function () {
                                return {Message: n, ShowCancel: !1, ConfirmTitle: t, UseNewLine: i}
                            }
                        },
                        controller: "DialogController as DialogCtrl"
                    }, f = this.$modal.open(u);
                    return f.result.then(r.resolve, r.reject), r.promise
                }, n.prototype.AutoCloseNotice = function (n, t) {
                    t === void 0 && (t = "確認");
                    var i = this.$q.defer(), r = {
                        templateUrl: "/V2/TypeScripts/Utilities/DialogUtility/confirm.html",
                        size: "sm",
                        windowClass: "confirm-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            dialogConfig: function () {
                                return {Message: n, ShowCancel: !1, ShowOk: !1, AutoClose: !0, ConfirmTitle: t}
                            }
                        },
                        controller: "DialogController as DialogCtrl"
                    }, u = this.$modal.open(r);
                    return u.result.then(i.resolve, i.reject), i.promise
                }, n.prototype.Confirm = function (n, t, i, r) {
                    t === void 0 && (t = "確認");
                    i === void 0 && (i = "取消");
                    r === void 0 && (r = !0);
                    var u = this.$q.defer(), f = {
                        templateUrl: "/V2/TypeScripts/Utilities/DialogUtility/confirm.html",
                        size: "sm",
                        windowClass: "confirm-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            dialogConfig: function () {
                                return {Message: n, ShowCancel: !0, ShowClose: r, ConfirmTitle: t, CancelTitle: i}
                            }
                        },
                        controller: "DialogController as DialogCtrl"
                    }, e = this.$modal.open(f);
                    return e.result.then(u.resolve, u.reject), u.promise
                }, n.prototype.Custom = function (n) {
                    var t = this.$q.defer(), i = {
                        templateUrl: n.templateUrl,
                        size: "lg",
                        windowClass: n.windowClass,
                        backdrop: typeof n.backdrop == "undefined" ? "static" : n.backdrop,
                        keyboard: !1,
                        resolve: {
                            dialogConfig: function () {
                                return {Title: n.title, Model: n.model}
                            }
                        },
                        controller: n.controller
                    }, r = this.$modal.open(i);
                    return r.result.then(t.resolve, t.reject), t.promise
                }, n.prototype.Customize = function (n, t) {
                    var i = this.$q.defer(), r = {
                        templateUrl: n.TemplateUrl,
                        size: n.Size || "lg",
                        windowClass: n.WindowClass,
                        backdropClass: n.BackdropClass,
                        backdrop: n.Backdrop || "static",
                        keyboard: !1,
                        resolve: {
                            DialogCustomizeConfig: function () {
                                return {Title: t.Title, Model: t.Model}
                            }
                        },
                        controller: n.Controller
                    }, u = this.$modal.open(r);
                    return u.result.then(i.resolve, i.reject), i.promise
                }, n.prototype.Toast = function (n, t) {
                    var i = this.$q.defer(), r = {
                        templateUrl: "/V2/TypeScripts/Utilities/DialogUtility/toast.html",
                        size: "sm",
                        windowClass: "result-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            dialogConfig: function () {
                                return {Message: n, AutoClose: t}
                            }
                        },
                        controller: "DialogController as DialogCtrl"
                    }, u = this.$modal.open(r);
                    return u.result.then(i.resolve, i.reject), i.promise
                }, n.$inject = ["$q", "$modal"], n
            }();
            n.DialogUtility = t;
            angular.module("NineYi.Mall.Utilities").service("DialogUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i) {
                    this.$cookies = n;
                    this.$log = t;
                    this.DeviceValue = i
                }

                return t.prototype.GetOSandVersion = function () {
                    var i = n.Mall.Models.DeviceOsEnum[this.DeviceValue.GetDeviceOS()], r = this.$cookies.appVer || "", t = r.split("."), u = t[0], f = t[1], e = t[2];
                    return this.$log.debug("Get App OS and Version, OS: ", i, ",Version: ", r), {
                        Version: this.$cookies.appVer,
                        MajorNumber: u,
                        MinorNumber: f,
                        MaintenanceNumber: e,
                        OS: i
                    }
                }, t.prototype.IsNewVersion = function (n) {
                    if (!n)return !1;
                    var t = n.split(".");
                    return t[0] === "1" && parseInt(t[1]) >= 18 ? !0 : t[0] === "2" && parseInt(t[1]) >= 2 ? !0 : !1
                }, t.prototype.IsFromApp = function () {
                    return this.$cookies.appVer ? !0 : !1
                }, t.$inject = ["$cookies", "$log", "DeviceValue"], t
            }();
            t.AppVersionUtility = i;
            angular.module("NineYi.Mall.Utilities").service("AppVersionUtility", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                    this.BodyElement = document.getElementsByTagName("body")[0]
                }

                return n.prototype.FreezeBody = function () {
                    this.BodyElement && !this.BodyElement.classList.contains("freeze") && (this.BodyElement.classList.add("freeze"), this.IsFreeze = !0)
                }, n.prototype.UnFreezeBody = function () {
                    this.BodyElement && this.BodyElement.classList.contains("freeze") && (this.BodyElement.classList.remove("freeze"), this.IsFreeze = !1)
                }, n.prototype.ToogleFreezeBody = function () {
                    this.BodyElement && (this.BodyElement.classList.contains("freeze") ? (this.BodyElement.classList.remove("freeze"), this.IsFreeze = !1) : (this.BodyElement.classList.add("freeze"), this.IsFreeze = !0))
                }, n
            }();
            n.FreezeBodyUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("FreezeBodyUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.DeviceValue = n;
                    this.$log = t;
                    this.IsShowMenu = !1
                }

                return n.prototype.Open = function (n) {
                    n && (this.MenuType = n);
                    this.HasOpenmenu = !0;
                    this.IsShowMenu = !0
                }, n.prototype.Close = function () {
                    this.IsShowMenu = !1
                }, n.prototype.Toggle = function (n) {
                    n && (this.MenuType = n);
                    this.IsShowMenu = !this.IsShowMenu;
                    this.IsShowMenu && (this.HasOpenmenu = !0)
                }, n.$inject = ["DeviceValue", "$log"], n
            }();
            n.MainMenuUtility = t;
            angular.module("NineYi.Mall.Utilities").service("MainMenuUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$window = n;
                    this.DeviceValue = t
                }

                return n.prototype.Register = function () {
                    var t = this, n, i;
                    this.DeviceValue.IsMobile() === !1 && (n = document.body, this.$window.addEventListener("scroll", function () {
                        t.$window.clearTimeout(i);
                        n.classList.contains("disable-hover") || n.classList.add("disable-hover");
                        i = t.$window.setTimeout(function () {
                            n.classList.remove("disable-hover")
                        }, 500)
                    }, !1))
                }, n.$inject = ["$window", "DeviceValue"], n
            }();
            n.ScrollDisableHoverUtility = t;
            angular.module("NineYi.Mall.Utilities").service("ScrollDisableHoverUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$q = n;
                    this.$modal = t
                }

                return n.prototype.AddRistrictionNote = function (n, t) {
                    var i = this.$q.defer(), r = {
                        templateUrl: "/V2/TypeScripts/Utilities/RistrictionUtility/ristrictionNote.html",
                        size: "lg",
                        windowClass: "ristriction-modal",
                        backdrop: "static",
                        keyboard: !1,
                        resolve: {
                            addRistrictionNote: function () {
                                return {Title: n, Message: t}
                            }
                        },
                        controller: "RistrictionNoteController as RistrictionNoteCtrl"
                    }, u = this.$modal.open(r);
                    return u.result.then(i.resolve, i.reject), i.promise
                }, n.$inject = ["$q", "$modal"], n
            }();
            n.RistrictionUtility = t;
            angular.module("NineYi.Mall.Utilities").service("RistrictionUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    var r = this;
                    this.$scope = n;
                    this.$modalInstance = t;
                    this.$window = i;
                    angular.element(document).ready(function () {
                        r.SetModalOpacity(.98)
                    })
                }

                return n.prototype.Enter = function () {
                    Modernizr.sessionstorage && sessionStorage.setItem("type", "Ristriction");
                    this.$modalInstance.close("enter");
                    this.SetModalOpacity(.5)
                }, n.prototype.Cancel = function () {
                    Modernizr.sessionstorage && sessionStorage.clear();
                    this.$window.location.href = "https://www.google.com.tw/"
                }, n.prototype.SetModalOpacity = function (n) {
                    angular.element(document.getElementsByClassName("modal-backdrop")).css("opacity", n)
                }, n.$inject = ["$scope", "$modalInstance", "$window"], n
            }();
            n.RistrictionNoteController = t;
            angular.module("NineYi.Mall.Utilities").controller("RistrictionNoteController", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t) {
                    this.$log = n;
                    this.$filter = t
                }

                return t.prototype.GetTypeDisplayName = function (t, i, r, u, f, e) {
                    var o = "";
                    return o = t === "Sent" && u ? "已中獎" : n.Mall.Mixin.invoiceStatusDisplayName(t), o + this.GetSendDateDisplayName(t, i, u, e) + this.GetSubMessage(t, i, r, f, e)
                }, t.prototype.GetSendDateDisplayName = function (n, t, i, r) {
                    var e = Date.now(), u = t ? this.$filter("nsDotNetDateParser")(t) : null, f = t ? this.$filter("date")(u, "yyyy/MM/dd") : "";
                    if (u) {
                        if ((r === "Mail" || r === null) && (n === "Issued" || n === "Prized" || n === "Sent" && i))return u >= e ? "(預計" + f + "寄出)" : "(" + f + "已寄出)";
                        if (r === "FamiPort" && (n === "Prized" || n === "Sent" && i))return "(FamiPort已列印)";
                        if (n === "Sent" && !i)return u >= e ? "" : "(" + f + "已寄出)"
                    }
                    return ""
                }, t.prototype.GetSubMessage = function (n, t, i, r, u) {
                    if (r === "TwoCopies")switch (n) {
                        case"Issued":
                            return i && !t ? "(修改寄送資訊)" : "";
                        case"Prized":
                            return t ? "" : u === "FamiPort" ? "(FamiPort未列印)" : "(填寫/修改寄送資訊)";
                        default:
                            return ""
                    }
                    return ""
                }, t.prototype.GetInvoicesDetailUrl = function (n, t, i, r, u) {
                    return n && t && (i || r) && u && n !== "None" ? "/V2/Invoice/InvoiceDetail/" + t + "?tsCode=" + i + "&tmCode=" + r + "&source=" + u : ""
                }, t.prototype.GetPrizedInvoicesDetailUrl = function (n, t, i, r, u) {
                    return n && t && (i || r) && u && n !== "None" ? "/V2/Invoice/FamiPortIllustrate/" + t + "?tsCode=" + i + "&tmCode=" + r + "&source=" + u : ""
                }, t.prototype.CanUpdateRequestDate = function (n, t, i, r, u) {
                    return n === "Issued" && r === "ThreeCopies" && !t && !i && u
                }, t.$inject = ["$log", "$filter"], t
            }();
            t.InvoiceStatusUtility = i;
            angular.module("NineYi.Mall.Utilities").service("InvoiceStatusUtility", i)
        })(i = t.Utilities || (t.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f) {
                    this.$rootScope = n;
                    this.$q = t;
                    this.$log = i;
                    this.traceSalePageService = r;
                    this.FacebookUtility = u;
                    this.SalePageService = f
                }

                return n.prototype.Add = function (n) {
                    var t = this, i = this.$q.defer();
                    return this.traceSalePageService.InsertItem(n).then(function () {
                        t.SalePageService.GetSalePage(n).then(function (n) {
                            t.FacebookUtility.TrackAddToWishlist([n.data.Id.toString()], n.data.CategoryText + "(" + n.data.ShopCategoryId + ")", n.data.Price, n.data.Title)
                        });
                        t.$log.info("Insert TraceSalePageList");
                        t.FavCount += 1;
                        t.RefreshFavCount();
                        i.resolve(!0)
                    }).catch(function () {
                        i.reject("remove failed")
                    }), i.promise
                }, n.prototype.Remove = function (n) {
                    var t = this, i = this.$q.defer();
                    return this.traceSalePageService.DeleteItem(n).then(function () {
                        t.$log.info("Delete TraceSalePageList");
                        t.FavCount -= 1;
                        t.RefreshFavCount();
                        i.resolve()
                    }).catch(function () {
                        i.reject("remove failed")
                    }), i.promise
                }, n.prototype.RefreshFavCount = function () {
                    this.$rootScope.$emit("RefreshFavCount")
                }, n.prototype.AfterRefresh = function (n) {
                    this.$rootScope.$on("RefreshFavCount", n)
                }, n.prototype.GetFavCount = function () {
                    var t = this, n = this.$q.defer();
                    return this.$log.info("Get TraceSalePageList Count - Start"), this.traceSalePageService.GetCount().then(function (i) {
                        t.$log.info("Get TraceSalePageList Count - Finish", i);
                        t.FavCount = i;
                        n.resolve(i)
                    }).catch(function () {
                        n.reject()
                    }), n.promise
                }, n.$inject = ["$rootScope", "$q", "$log", "TraceSalePageService", "FacebookUtility", "SalePageService"], n
            }();
            n.FavoriteUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("FavoriteUtility", ["$rootScope", "$q", "$log", "TraceSalePageService", "FacebookUtility", "SalePageService", function (n, i, r, u, f, e) {
                return new t(n, i, r, u, f, e)
            }])
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                }

                return n.prototype.Translate3d = function (n, t) {
                    n && (n.style.transform = "translate3d(0, " + t + "px, 0)", n.style["-webkit-transform"] = "translate3d(0, " + t + "px, 0)", n.style["-moz-transform"] = "translate3d(0, " + t + "px, 0)", n.style["-ms-transform"] = "translate3d(0, " + t + "px, 0)")
                }, n
            }();
            n.AnimeUtility = t;
            angular.module("NineYi.Mall.Utilities").factory("AnimeUtility", function () {
                return new t
            })
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f, e, o, s, h, c) {
                    this.ShopId = n;
                    this.$window = t;
                    this.FanGroupUrl = i;
                    this.IsEnableFBMessenger = r;
                    this.IsEnableFBMessengerNonWorkingTime = u;
                    this.FBMessengerWorkingStartWeekDay = f;
                    this.FBMessengerWorkingEndWeekDay = e;
                    this.FBMessengerWorkingStartTime = o;
                    this.FBMessengerWorkingEndTime = s;
                    this.DialogUtility = h;
                    this.FBAppId = c;
                    this.FBFanName = this.FanGroupUrl ? this.FanGroupUrl.replace("https://www.facebook.com/", "") : "";
                    this.FanGroupUrlString = this.FanGroupUrl;
                    this.FBMessenger = {
                        serviceStartDay: null,
                        serviceEndDay: null,
                        serviceStartHour: null,
                        serviceStartMinutes: null,
                        serviceEndHour: null,
                        serviceEndMinutes: null,
                        hasService: this.IsEnableFBMessenger
                    };
                    this.FbAppId = this.FBAppId
                }

                return n.prototype.IsFBMessengerServiceTime = function () {
                    if (this.FBMessenger.hasService) {
                        var n = !0, t = new Date, i = t.getDay() === 0 ? 7 : t.getDay(), r = new Date, u = new Date;
                        return this.FBMessenger.hasService = !0, this.FBMessenger.serviceStartDay = this.FBMessenger.serviceStartDay || +this.FBMessengerWorkingStartWeekDay, this.FBMessenger.serviceEndDay = this.FBMessenger.serviceEndDay || +this.FBMessengerWorkingEndWeekDay, this.FBMessenger.serviceStartHour = this.FBMessenger.serviceStartHour || +/([0-9]+):/i.exec(this.FBMessengerWorkingStartTime)[1], this.FBMessenger.serviceStartMinutes = this.FBMessenger.serviceStartMinutes || +/:([0-9]+)/i.exec(this.FBMessengerWorkingStartTime)[1], this.FBMessenger.serviceEndHour = this.FBMessenger.serviceEndHour || +/([0-9]+):/i.exec(this.FBMessengerWorkingEndTime)[1], this.FBMessenger.serviceEndMinutes = this.FBMessenger.serviceEndMinutes || +/:([0-9]+)/i.exec(this.FBMessengerWorkingEndTime)[1], n && this.FBMessenger.serviceStartDay === this.FBMessenger.serviceEndDay && i !== this.FBMessenger.serviceStartDay && (n = !1), n && this.FBMessenger.serviceStartDay !== this.FBMessenger.serviceEndDay && (i < this.FBMessenger.serviceStartDay || i > this.FBMessenger.serviceEndDay) && (n = !1), r.setHours(this.FBMessenger.serviceStartHour), r.setMinutes(this.FBMessenger.serviceStartMinutes), u.setHours(this.FBMessenger.serviceEndHour), u.setMinutes(this.FBMessenger.serviceEndMinutes), n && (t.getTime() - r.getTime() < 0 || t.getTime() - u.getTime() > 0) && (n = !1), n || this.IsEnableFBMessengerNonWorkingTime || (this.FBMessenger.hasService = !1), this.$window.location.href.match(/\/v2\/ShoppingCart/i) && (this.FBMessenger.hasService = !1), this.$window.location.href.match(/\/v2\/Pay/i) && (this.FBMessenger.hasService = !1), this.$window.location.href.match(/\/Question\/QuestionInsert/i) && (this.FBMessenger.hasService = !1), n
                    }
                }, n.prototype.ConfirmQuestionService = function () {
                    var n = this;
                    this.DialogUtility.Confirm("非線上客服時間，如有問題請填寫客服留言，我們將盡速回覆您。", "填寫客服留言", "取消").then(function () {
                        n.$window.location.replace("/Question/QuestionInsert/0?sId=" + n.ShopId)
                    })
                }, n.prototype.GetFBMessengerSrc = function () {
                    return "https://www.facebook.com/plugins/page.php?href=" + this.FanGroupUrl + "&tabs=messages&width=340&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true" + ("&appId=" + this.FbAppId)
                }, n.$inject = ["ShopId", "$window", "FanGroupUrl", "IsEnableFBMessenger", "IsEnableFBMessengerNonWorkingTime", "FBMessengerWorkingStartWeekDay", "FBMessengerWorkingEndWeekDay", "FBMessengerWorkingStartTime", "FBMessengerWorkingEndTime", "DialogUtility", "FBAppId"], n
            }();
            n.FBMessengerUtility = t;
            angular.module("NineYi.Mall.Utilities").service("FBMessengerUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.ShopId = n;
                    this.OnlineCRM = t;
                    this.OnlineCRMCode = i;
                    this.OnlineCRM && this.OnlineCRMCode && (this.lineUrl = "https://line.naver.jp/ti/p/" + this.OnlineCRMCode)
                }

                return n.$inject = ["ShopId", "OnlineCRM", "OnlineCRMCode"], n
            }();
            n.LineUtility = t;
            angular.module("NineYi.Mall.Utilities").service("LineUtility", t)
        })(t = n.Utilities || (n.Utilities = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsLazyLoad", ["$log", "$window", "$timeout", function (n, t, i) {
                return {
                    restrict: "A", scope: !1, link: function (r, u, f) {
                        function c() {
                            var t = f.nsLazyLoad, n = u[0].querySelectorAll("." + t)[0];
                            n && n.getBoundingClientRect().top - s <= h && o()
                        }

                        function o() {
                            var i = u[0].getBoundingClientRect().top;
                            i - s <= h && (l(f.nsLazyLoad), (!f.lazyLoadAlarmClock && e === !0 || +f.lazyLoadAlarmClock < 0 && e === !0) && (n.debug("remove listener"), t.removeEventListener("scroll", o, !1)))
                        }

                        function l(n) {
                            var t = u[0].querySelectorAll("." + n);
                            [].slice.call(t).forEach(function (t) {
                                var r = t.dataset && t.dataset.tempSrc || t.getAttribute("data-temp-src"), i;
                                if (r) {
                                    switch (n) {
                                        case"sleeping-img":
                                            t.setAttribute("src", r);
                                            t.classList.remove("sleeping-img");
                                            break;
                                        case"sleeping-background":
                                            t.style.backgroundImage = "url(" + r + ")";
                                            t.classList.remove("sleeping-background");
                                            break;
                                        case"sleeping-iframe":
                                            i = document.createElement("iframe");
                                            i.classList.add("h100p");
                                            i.setAttribute("src", r);
                                            i.setAttribute("frameborder", "0");
                                            t.appendChild(i);
                                            t.classList.remove("sleeping-iframe")
                                    }
                                    e = !0
                                }
                            })
                        }

                        var s = f.offsetY || 0, h = t.innerHeight, e = !1;
                        i(function () {
                            c();
                            t.addEventListener("scroll", o, !1);
                            typeof f.activeTrigger != "undefined" && f.$observe("activeTrigger", function (n) {
                                n === "true" && i(function () {
                                    c()
                                }, 1e3)
                            })
                        }, 0)
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$log = n;
                    this.$window = t;
                    this.ElementUtility = i;
                    this.scope = {onVisiable: "&"};
                    this.restrict = "AE";
                    this.link = function (r, u) {
                        function e() {
                            var c = u[0].style.display !== "none", o = t.pageYOffset, l = o + t.innerHeight, s = i.getElementOffset(u[0]), h = s.top, a = h + s.height, v = a <= l && h >= o && c;
                            v && r.$apply(function () {
                                n.debug("onVisiable - run");
                                r.onVisiable();
                                f.off("scroll", e);
                                n.debug("onVisiable - disable")
                            })
                        }

                        var f = angular.element(t);
                        f.on("scroll", e)
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$log", "$window", "ElementUtility"], t
                }, n
            }();
            n.WatchScrollVisiableDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsWatchScrollVisiable", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                    this.restrict = "EA";
                    this.scope = {onShow: "&?", showSpinner: "="};
                    this.templateUrl = "/V2/TypeScripts/Directives/ns-spinner/spinnerDirective.html";
                    this.link = function (n) {
                        n.$watch("showSpinner", function (t, i) {
                            t && t !== i && (n.showSpinner = t)
                        })
                    }
                }

                return n.instance = function () {
                    var t = function () {
                        return new n
                    };
                    return t.$inject = [], t
                }, n
            }();
            n.SpinnerDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsSpinner", t.instance())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            function i(t, i, r, u, f, e) {
                return {
                    restrict: "AE", templateUrl: function (n, t) {
                        return t.templateUrl ? t.templateUrl : "/V2/TypeScripts/Directives/ns-carousel/carouselDirective.html"
                    }, scope: {carouselList: "=ngModel"}, link: function (o, s) {
                        function it() {
                            h = s[0].querySelector(".carousel-ul");
                            ut(h);
                            rt();
                            y = o.carouselList.length;
                            ft(h, c);
                            h.addEventListener("touchstart", pt, !1);
                            h.addEventListener("touchend", wt, !1);
                            yt();
                            w = nt()
                        }

                        function rt() {
                            l = s[0].querySelector(".carousel-ul").getBoundingClientRect().width;
                            c = -l;
                            p = 0;
                            k = 0;
                            v = 0;
                            g = 0
                        }

                        function yt() {
                            b = !0;
                            r.addEventListener("scroll", function () {
                                var n = s[0].querySelector(".carousel").getBoundingClientRect().bottom;
                                n < 0 && n > -200 && b && (t.debug("stop carousel"), u.cancel(w), b = !1);
                                n >= 0 && !b && (t.debug("start carousel"), w = nt(), b = !0)
                            })
                        }

                        function ut(n) {
                            t.debug(n.offsetWidth);
                            n && (n.style.width = n.offsetWidth + "px")
                        }

                        function ft(n, t) {
                            n && i(function () {
                                a(n, t)
                            }, 0)
                        }

                        function nt() {
                            return u(function () {
                                o.goNext()
                            }, 8e3)
                        }

                        function et(n) {
                            return n.target.parentElement.className === "video-mask"
                        }

                        function pt(n) {
                            var t = n.changedTouches[0];
                            n.target.parentElement.style.pointerEvents = "none";
                            et(t) === !1 && (p = parseInt(t.clientX), k = parseInt(t.clientY), h.addEventListener("touchmove", ot, !1), ht(h), u.cancel(w))
                        }

                        function ot(n) {
                            var i = n.changedTouches[0];
                            if (!p || !k) {
                                t.debug("no touch data");
                                return
                            }
                            var r = i.clientX, u = i.clientY, f = p - r, e = k - u;
                            Math.abs(f) > Math.abs(e) ? (v = parseInt(i.clientX) - p + c, a(h, v)) : t.debug("swipe to top or bottom")
                        }

                        function wt(n) {
                            var t = n.changedTouches[0];
                            et(t) === !1 && (h.removeEventListener("touchmove", ot, !1), d(h, "0.3s"), bt(), w = nt(), n.target.parentElement.style.pointerEvents = "", g = v)
                        }

                        function bt() {
                            if (t.debug("dis = " + c + " ; tempDist = " + v), v === g) {
                                t.debug("same of tempDist");
                                return
                            }
                            Math.abs(v - c) > l / 6 ? v > -l ? (t.debug("change slide - to last"), a(h, 0), lt(300)) : v < -l * y ? (t.debug("change slide - to first"), a(h, -l * (y + 1)), ct(300)) : c > v ? (t.debug("change slide - to next"), vt()) : (t.debug("change slide - to prev"), at()) : (t.debug("back slide"), a(h, c))
                        }

                        function a(n, t) {
                            n && !o.ShowVideo && i(function () {
                                n.style.transform = "translate3d(" + t + "px, 0, 0)";
                                n.style["-webkit-transform"] = "translate3d(" + t + "px, 0, 0)";
                                n.style["-moz-transform"] = "translate3d(" + t + "px, 0, 0)";
                                n.style["-ms-transform"] = "translate3d(" + t + "px, 0, 0)"
                            }, 0)
                        }

                        function st(n, t, r) {
                            n && i(function () {
                                ht(n);
                                a(n, t)
                            }, r)
                        }

                        function ht(n) {
                            n && n.style.removeProperty("transition")
                        }

                        function d(n, t) {
                            n && (n.style.transition = "transform " + t)
                        }

                        function ct(n) {
                            o.currentIndex = 0;
                            c = -l;
                            st(h, c, n)
                        }

                        function lt(n) {
                            o.currentIndex = y - 1;
                            c = -l * y;
                            st(h, c, n)
                        }

                        function at() {
                            o.currentIndex = o.currentIndex - 1;
                            c = c + l;
                            a(h, c)
                        }

                        function vt() {
                            o.currentIndex = o.currentIndex + 1;
                            c = c - l;
                            a(h, c)
                        }

                        function kt(n) {
                            o.currentIndex = n;
                            c = -l * (n + 1);
                            d(h, "0.8s");
                            a(h, c)
                        }

                        var h, l, p, k, y, c, v, g, w, b, tt;
                        o.CarouseMediaTypeEnum = n.Mall.Directives.CarouseMediaTypeEnum;
                        o.carouselList && o.carouselList.length > 0 ? it() : tt = o.$watch("carouselList", function (n, t) {
                                n && n !== t && (i(function () {
                                    it()
                                }, 0), tt())
                            });
                        r.addEventListener("resize", function () {
                            h = s[0].querySelector(".carousel-ul");
                            h && (h.removeAttribute("style"), ut(h), rt(), ft(h, c))
                        });
                        o.currentIndex = 0;
                        o.goPrev = function () {
                            o.ShowVideo = !1;
                            d(h, "0.8s");
                            o.currentIndex === 0 ? (a(h, 0), lt(850)) : at()
                        };
                        o.goNext = function () {
                            o.ShowVideo = !1;
                            d(h, "0.8s");
                            o.currentIndex === y - 1 ? (a(h, -l * (y + 1)), ct(850)) : vt()
                        };
                        o.doJump = function (n) {
                            kt(n)
                        };
                        o.playVideo = function (n) {
                            n.preventDefault();
                            n.stopPropagation();
                            o.ShowVideo = !0;
                            o.InitVideo = !0;
                            t.debug("play video")
                        };
                        o.TrackCarouselEvent = function (t) {
                            if (e && e.HasNewVersionSwitch) {
                                var i = e.BrowserMode === n.WebStore.Frontend.BE.Device.DeviceModeEnum.Desktop ? "首頁廣告" : "首頁廣告_M";
                                f.TrackEvent(i, "活動型V1", "1_官網輪播看板")
                            } else t && f.TrackEvent("輪播看板", "click", "輪播看板" + (t + 1))
                        }
                    }
                }
            }

            (function (n) {
                n[n.Image = 0] = "Image";
                n[n.Video = 1] = "Video"
            })(t.CarouseMediaTypeEnum || (t.CarouseMediaTypeEnum = {}));
            var r = t.CarouseMediaTypeEnum;
            i.$inject = ["$log", "$timeout", "$window", "$interval", "GoogleAnalyticsUtility", "OfficialShopProfile"];
            angular.module("NineYi.Mall.Directives").directive("nsCarousel", i)
        })(i = t.Directives || (t.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    var r = this;
                    this.$log = n;
                    this.$window = t;
                    this.$parse = i;
                    this.restrict = "A";
                    this.link = function (n, t, i) {
                        if (i.nsClickOutside) {
                            var u = t[0], e = r.$parse(i.nsClickOutside), f = function (t) {
                                u === t.target || u.contains(t.target) || n.$apply(e)
                            };
                            r.$window.addEventListener("click", f, !0);
                            n.$on("$destroy", function () {
                                r.$window.removeEventListener("click", f)
                            })
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$log", "$window", "$parse"], t
                }, n
            }();
            n.ClickOutsideDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsClickOutside", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n) {
                    var t = this;
                    this.$window = n;
                    this.restrict = "A";
                    this.link = function (n, i, r) {
                        var u = i[0], f = angular.element(t.$window);
                        n.fixedClassName = r.fixedClassName ? r.fixedClassName : "fixed-header";
                        t.$window.setTimeout(function () {
                            if (n.IsOnTop() === !1) {
                                n.fixedOffset = u.clientHeight + u.offsetTop;
                                f.on("scroll", n.FixHeader)
                            } else u.classList.contains(n.fixedClassName) || u.classList.add(n.fixedClassName)
                        }, 2e3);
                        n.FixHeader = function () {
                            t.$window.pageYOffset > n.fixedOffset ? u.classList.contains(n.fixedClassName) || u.classList.add(n.fixedClassName) : u.classList.contains(n.fixedClassName) && u.classList.remove(n.fixedClassName)
                        };
                        n.IsOnTop = function () {
                            return u.offsetTop === 0
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t) {
                        return new n(t)
                    };
                    return t.$inject = ["$window"], t
                }, n
            }();
            n.StickyHeaderDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsStickyHeader", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    var r = this;
                    this.$window = n;
                    this.UserAgentUtility = t;
                    this.DeviceValue = i;
                    this.restrict = "A";
                    this.scope = {fixedOffset: "=?nsFixedOffset"};
                    this.link = function (n, t, i) {
                        var f = i.fullParentContainer, u = t[0];
                        n.isSupportCssSticky = i.useSticky ? Modernizr.csspositionsticky : !1;
                        n.$windowElem = angular.element(r.$window);
                        n.fixedTop = i.fixedTop ? i.fixedTop : 0;
                        n.fixedClassName = i.fixedClassName ? i.fixedClassName : "fixed-header";
                        r.$window.setTimeout(function () {
                            n.fixedOffset = n.fixedOffset ? n.fixedOffset : u.offsetTop - n.fixedTop;
                            n.$windowElem.on("scroll", n.AddFixClass)
                        }, 3e3);
                        n.AddFixClass = function () {
                            if (r.$window.pageYOffset >= n.fixedOffset) {
                                if (n.isSupportCssSticky) u.parentElement.classList.contains("sticky") || u.parentElement.classList.add("sticky"); else if (u.classList.contains(n.fixedClassName) || u.classList.add(n.fixedClassName), f === "true") {
                                    var i = t.parent()[0];
                                    u.style.width = i && i.getBoundingClientRect().width + "px"
                                }
                            } else n.isSupportCssSticky ? u.parentElement.classList.contains("sticky") && u.parentElement.classList.remove("sticky") : (u.classList.contains(n.fixedClassName) && u.classList.remove(n.fixedClassName), f === "true" && (u.style.width = "initial"))
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$window", "UserAgentUtility", "DeviceValue"], t
                }, n
            }();
            n.StickyDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsSticky", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$timeout = n;
                    this.facebook = t;
                    this.scope = {page: "@", height: "@", faces: "@", posts: "@", hideCover: "@", width: "@"};
                    this.template = '<div ng-if="IsSdkInitialized" class="fb-page" data-href="{{page}}"data-hide-cover="{{hideCover}}" data-width="{{width}}" data-show-facepile="{{faces}}"data-height="{{height}}"data-show-posts="{{posts}}"><\/div>';
                    this.restrict = "EA";
                    this.link = function (n) {
                        n.height = n.height | 550;
                        n.faces = n.faces || !1;
                        n.posts = n.posts || !0;
                        n.hide = n.hide || !1;
                        n.width = n.width | 300;
                        n.$watch(function () {
                            return t.isReady()
                        }, function () {
                            n.IsSdkInitialized = !0
                        })
                    }
                }

                return n.factory = function () {
                    var t = function (t, i) {
                        return new n(t, i)
                    };
                    return t.$inject = ["$timeout", "Facebook"], t
                }, n
            }();
            n.FacebookPageDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsFacebookPage", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsRepeatEnd", [function () {
                return {
                    restrict: "A", link: function (n) {
                        n.$last && n.$emit("onRepeatEnd")
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsTouch", ["$parse", "$rootScope", function (n, t) {
                return {
                    restrict: "A", compile: function (i, r) {
                        var u = n(r.nsTouch, null, !0);
                        return function (n, i) {
                            i.on("touchstart", function (i) {
                                var r = function () {
                                    u(n, {$event: i})
                                };
                                t.$$phase ? n.$evalAsync(r) : n.$apply(r)
                            })
                        }
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    var i = this;
                    this.$log = n;
                    this.$timeout = t;
                    this.restrict = "A";
                    this.link = function (n, t, r) {
                        var u, f, e;
                        if (n.$event = {
                                name: "",
                                isSecure: !1,
                                isRunning: !1,
                                target: t[0],
                                types: {start: "mousedown", move: "mousemove", end: "mouseup", cancel: ""},
                                time: {start: 0, end: 0, duration: 0},
                                coords: {start: {x: 0, y: 0}, end: {x: 0, y: 0}},
                                events: {start: null, move: null, end: null, cancel: null},
                                directionX: 0,
                                directionY: 0,
                                offsetX: 0,
                                offsetY: 0,
                                holdfor: 0,
                                threshold: 0
                            }, u = function (t) {
                                n.$event.name = t;
                                !r[t] || (n.$eval(r[t]), n.$apply())
                            }, typeof window.ontouchstart != "undefined" && typeof window.ontouchend != "undefined" && typeof window.ontouchcancel != "undefined" ? (n.$event.types.start = "touchstart", n.$event.types.move = "touchmove", n.$event.types.end = "touchend", n.$event.types.cancel = "touchcancel", f = function (n) {
                                    var t = !!n && !!n.changedTouches && !!(n.changedTouches.length > 0) ? n.changedTouches[0] : {};
                                    return {x: t.pageX || n.pageX || 0, y: t.pageY || n.pageY || 0}
                                }) : window.navigator.pointerEnabled ? (n.$event.types.start = "pointerdown", n.$event.types.move = "pointermove", n.$event.types.end = "pointerup") : window.navigator.msPointerEnabled ? (n.$event.types.start = "MSPointerDown", n.$event.types.move = "MSPointerMove", n.$event.types.end = "MSPointerUp", n.$event.types.cancel = "MSPointerOut") : f = function (n) {
                                            return {x: n.pageX || 0, y: n.pageY || 0}
                                        }, !r.tap) {
                            n.$event.isSecure = !0;
                            var o = null, h = function (t) {
                                n.$event.isRunning && (n.$event.events.move = t)
                            }, s = function (t) {
                                !o || i.$timeout.cancel(o);
                                n.$event.isRunning && (n.$event.isRunning = !1, n.$event.time.end = (new Date).getTime(), n.$event.time.duration = n.$event.time.end - n.$event.time.start, n.$event.events.end = t, n.$event.coords.end = f(t), n.$event.directionX = n.$event.coords.end.x - n.$event.coords.start.x, n.$event.directionY = n.$event.coords.end.y - n.$event.coords.start.y, n.$event.offsetX = Math.abs(n.$event.directionX), n.$event.offsetY = Math.abs(n.$event.directionY), n.$event.offsetX <= n.$event.threshold && n.$event.offsetY <= n.$event.threshold ? !!r.hold && n.$event.time.duration >= n.$event.holdfor ? u("hold") : u("secureTap") : n.$event.offsetX >= n.$event.offsetY ? u(n.$event.directionX > 0 ? "swipeRight" : "swipeLeft") : u(n.$event.directionY > 0 ? "swipeDown" : "swipeUp"))
                            }, e = function (t) {
                                n.$event.isRunning = !0;
                                n.$event.time.start = (new Date).getTime();
                                n.$event.events.start = t;
                                n.$event.coords.start = f(t);
                                !r.hold || (o = i.$timeout(function () {
                                    s(n.$event.events.move || t)
                                }, n.$event.holdfor, !1))
                            };
                            n.$event.target.addEventListener(n.$event.types.start, e, !1);
                            n.$event.target.addEventListener(n.$event.types.end, s, !1);
                            !n.$event.types.cancel || n.$event.target.addEventListener(n.$event.types.cancel, s, !1);
                            !r.hold || n.$event.target.addEventListener(n.$event.types.move, h, !1)
                        } else n.$event.isSecure = !1, n.$event.isRunning = !1, e = function (t) {
                            n.$event.events.start = t;
                            n.$event.coords.start = f(t);
                            u("tap")
                        }, n.$event.target.addEventListener(n.$event.types.start, e, !1)
                    }
                }

                return n.factory = function () {
                    var t = function (t, i) {
                        return new n(t, i)
                    };
                    return t.$inject = ["$log", "$timeout"], t
                }, n
            }();
            n.TouchSwipeDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsTouchSwipe", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            function n(n, t, i) {
                return {
                    restrict: "A", scope: {src: "="}, link: function (r, u, f) {
                        u.on("load", function () {
                            n.debug("Image Loaded: " + f.src);
                            u.off("load");
                            t(function () {
                                u.attr("src", f.nsLazyImage)
                            }, i.lazyLoadDelay)
                        })
                    }
                }
            }

            n.$inject = ["$log", "$timeout", "Mall.Config"];
            angular.module("NineYi.Mall.Directives").directive("nsLazyImage", n)
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsEndLessList", ["$log", "$window", function (n, t) {
                return {
                    restrict: "A",
                    scope: {
                        endLessModel: "=",
                        startIndex: "=",
                        isLock: "=",
                        getModelMethod: "&",
                        scrollElementId: "=?",
                        scrollListener: "=?",
                        isEnd: "=?"
                    },
                    link: function (i, r, u) {
                        function f() {
                            var e = "body", f = angular.element(t), o;
                            i.scrollElementId && (e = i.scrollElementId, f = angular.element(document.querySelector(e)));
                            o = function (i, r) {
                                var u = {fireY: document.querySelector("body").scrollHeight / 2, scrollY: 0};
                                return {
                                    fire: function () {
                                        function e() {
                                            if (i.startIndex >= 0 && !i.isLock && i.isEnd !== !0) {
                                                var o = r[0].getBoundingClientRect();
                                                u.scrollY = t.scrollY || t.pageYOffset;
                                                u.fireY = o.top + o.height / 2;
                                                u.scrollY >= u.fireY && (n.debug("endless list keep going"), i.$apply(i.getModelMethod))
                                            } else(i.startIndex < 0 || i.isEnd === !0) && (n.debug("endless list finish"), f.off("scroll", e))
                                        }

                                        i.scrollListener = {listener: f, event: e};
                                        f.on("scroll", e)
                                    }
                                }
                            }(i, r, u).fire()
                        }

                        if (i.endLessModel && i.endLessModel.length > 0) f(); else var e = i.$watch("endLessModel", function (n, t) {
                            n !== t && (f(), e())
                        });
                        i.$watch("isEnd", function (n, t) {
                            typeof n != "undefined" && n !== t && (i.isEnd = n)
                        })
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n) {
                    var t = this;
                    this.$window = n;
                    this.restrict = "A";
                    this.link = function (i, r, u) {
                        var f = 0, e = function () {
                            var t = n.scrollY, e = u.triggerOffsetY, i = u.effectCssClass;
                            t < e && t !== 0 || (t > f ? r.addClass(i) : r.removeClass(i), f = t)
                        };
                        r.ready(function () {
                            t.$window.addEventListener("scroll", e)
                        })
                    }
                }

                return n.factory = function () {
                    var t = function (t) {
                        return new n(t)
                    };
                    return t.$inject = ["$window"], t
                }, n
            }();
            n.ScrollToggleClassDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsScrollToggleClass", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    var i = this;
                    this.$log = n;
                    this.GoogleAnalyticsUtility = t;
                    this.restrict = "A";
                    this.link = function (n, t, r) {
                        var u = !1;
                        n.SendEventTrack = function (n) {
                            n.type === "click" && (u = !0);
                            u && i.GoogleAnalyticsUtility.TrackEvent(r.trackCategory, r.trackAction, r.trackLabel)
                        };
                        t.on("touchstart", function () {
                            u = !0
                        });
                        t.on("touchmove", function () {
                            u = !1
                        });
                        t.on("click touchend", n.SendEventTrack)
                    }
                }

                return n.factory = function () {
                    var t = function (t, i) {
                        return new n(t, i)
                    };
                    return t.$inject = ["$log", "GoogleAnalyticsUtility"], t
                }, n
            }();
            n.GAEventTrackDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsGaEventTrack", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    this.$log = n;
                    this.GoogleAnalyticsEcommerceUtility = t;
                    this.restrict = "A";
                    this.link = function (n, i, r) {
                        var u = !1;
                        n.SendProductClick = function (n) {
                            if (n.type === "click" && (u = !0), u) {
                                var i = {
                                    id: r.productId,
                                    name: "(" + r.productId + ")" + r.productName,
                                    price: r.productPrice,
                                    position: r.productPosition
                                }, f = r.listName;
                                t.ProductClicks(i, f)
                            }
                        };
                        i.on("touchstart", function () {
                            u = !0
                        });
                        i.on("touchmove", function () {
                            u = !1
                        });
                        i.on("click touchend", n.SendProductClick)
                    }
                }

                return n.factory = function () {
                    var t = function (t, i) {
                        return new n(t, i)
                    };
                    return t.$inject = ["$log", "GoogleAnalyticsEcommerceUtility"], t
                }, n
            }();
            n.GAECommerceProductClicksDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsGaEcProductClicks", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsScrollToTop", ["$window", function (n) {
                return {
                    restrict: "A", link: function (t, i) {
                        function e(t) {
                            var i = n.scrollY || n.pageYOffset, r = -i / (t / 15), u = setInterval(function () {
                                i = n.scrollY || n.pageYOffset;
                                i != 0 ? n.scrollBy(0, r) : clearInterval(u)
                            }, 15)
                        }

                        function r() {
                            var t = n.scrollY || n.pageYOffset;
                            t -= 100;
                            n.scrollTo(0, t);
                            t > 0 && requestAnimationFrame(r)
                        }

                        var u = n.innerHeight, f = angular.element(n);
                        i.on("click", function (t) {
                            var i = n.scrollY || n.pageYOffset;
                            t.preventDefault();
                            t.stopPropagation();
                            i > 600 && n.scrollTo(0, 600);
                            window.requestAnimationFrame ? requestAnimationFrame(r) : e(300)
                        });
                        f.on("scroll", function () {
                            var t = n.scrollY || n.pageYOffset;
                            t > u ? i.removeClass("hide-over-bottom") : i.addClass("hide-over-bottom")
                        })
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    var r = this;
                    this.$window = n;
                    this.$timeout = t;
                    this.animeUtility = i;
                    this.restrict = "AE";
                    this.transclude = !0;
                    this.templateUrl = "/V2/TypeScripts/Directives/ns-slide-list/slideListDirective.html";
                    this.link = function (n, t, i) {
                        var e = t[0], f = parseInt(i.itemWidth), u = parseInt(i.itemCount);
                        n.currentSlide = 0;
                        n.changeSlide = function () {
                            var i = -1 * f * u * n.currentSlide, t = "translate3d(" + i + "px, 0px, 0px)";
                            r.slideContentElement.style.transform = t;
                            r.slideContentElement.style["-webkit-transform"] = t;
                            r.slideContentElement.style["-moz-transform"] = t;
                            r.slideContentElement.style["-o-transform"] = t;
                            r.slideContentElement.style["-ms-transform"] = t
                        };
                        n.goToNext = function () {
                            r.slideContentElement && n.currentSlide < n.pagerCount - 1 && (n.currentSlide = n.currentSlide + 1, n.changeSlide())
                        };
                        n.goToPrev = function () {
                            r.slideContentElement && n.currentSlide > 0 && (n.currentSlide = n.currentSlide - 1, n.changeSlide())
                        };
                        n.initSlide = function () {
                            var t = e.querySelector(".ns-slide-list");
                            t.style.width = f * u + "px";
                            r.$timeout(function () {
                                if (r.slideContentElement = e.querySelector(".slide-container"), r.slideContentElement) {
                                    var t = r.slideContentElement.querySelectorAll(".slide-item");
                                    n.slidesNum = t.length;
                                    r.slideContentElement.style.width = f * u * n.slidesNum + "px";
                                    n.pagerCount = ~~(n.slidesNum / u) + 1
                                }
                            })
                        };
                        n.initSlide()
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$window", "$timeout", "AnimeUtility"], t
                }, n
            }();
            n.SlideListDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsSlideList", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsSvgLoadMore", function () {
                return {
                    replace: !0,
                    restrict: "E",
                    templateUrl: "/V2/TypeScripts/Components/ns-svg/svgLoadMoreDirective.html"
                }
            })
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t) {
                    var i = this;
                    this.$log = n;
                    this.$timeout = t;
                    this.scope = {onClick: "&", isLoading: "=", isEnded: "="};
                    this.templateUrl = "/V2/TypeScripts/Components/ns-load-more/loadMoreDirective.html";
                    this.restrict = "AE";
                    this.link = function (n) {
                        n.isLoading = n.isLoading || !1;
                        n.ClickLoadMore = function () {
                            i.$log.debug("loadMore start");
                            i.$timeout(function () {
                                n.$apply(function () {
                                    n.onClick();
                                    i.$log.debug("loadMore end")
                                })
                            })
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t, i) {
                        return new n(t, i)
                    };
                    return t.$inject = ["$log", "$timeout"], t
                }, n
            }();
            n.LoadMoreDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsLoadMore", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsAd", ["$log", "$window", "LayoutTemplateDataService", function (n, t, i) {
                return {
                    link: function (r, u, f) {
                        var e = f.code, o = f.adCode, s = f.hdAdCode;
                        o && s && (e = t.innerWidth >= 768 ? s : o);
                        n.info("Get LayoutTemplate Data - Start", e);
                        i.GetLayoutTemplateData(e).success(function (t) {
                            n.info("Get LayoutTemplate Data - Finish", e);
                            angular.forEach(t, function (n) {
                                n.PicturePath && n.PicturePath.FullUrl && (n.PicturePath.FullUrl = n.PicturePath.FullUrl.replace(/\/t\//, "/s/"))
                            });
                            r.AdDataList = t;
                            n.debug("LayoutTemplateData", e, r.AdDataList)
                        })
                    }, restrict: "EA", replace: !0, template: "<div ng-transclude><\/div>", transclude: !0
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsAdBoard", ["$log", "$window", function (n, t) {
                return {
                    restrict: "EA",
                    template: "<div ng-transclude><\/div>",
                    transclude: !0,
                    scope: {ngModel: "=", adCode: "@", hdAdCode: "@", useHd: "@", action: "@", useAllDevice: "@"},
                    link: function (n, i, r, u, f) {
                        function e() {
                            if (!n.useAllDevice && i[0].ownerDocument.defaultView.getComputedStyle(i[0]).display === "none") {
                                n.boardDataList = [];
                                return
                            }
                            var r = {
                                ngModel: n.ngModel || [],
                                adCode: n.adCode || "",
                                hdAdCode: n.hdAdCode || "",
                                useHD: n.useHd === "true" ? !0 : undefined,
                                adCodeList: n.ngModel && (n.ngModel[n.adCode] || []),
                                hdAdCodeList: n.ngModel && (n.ngModel[n.hdAdCode] || []),
                                transclude: function () {
                                    f(n, function (n) {
                                        i.empty();
                                        i.append(n)
                                    })
                                }
                            };
                            typeof r.useHD == "undefined" && t.innerWidth < 768 && (r.useHD = !1);
                            typeof r.useHD == "undefined" && t.innerWidth >= 768 && (r.useHD = !0);
                            r.useHD === !1 && r.adCodeList.length > 0 ? (n.boardDataList = r.adCodeList, r.transclude()) : r.useHD === !0 && r.hdAdCodeList.length > 0 ? (n.boardDataList = r.hdAdCodeList, r.transclude()) : (n.boardDataList = [], i.remove(), r.useHD)
                        }

                        if (n.ngModel) e(); else var o = n.$watch("ngModel", function (t, i) {
                            t !== i ? (e(), o()) : n.ngModel && e()
                        })
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsSearch", ["$window", "$sce", "SearchService", "ShopId", "OfficialOriginDomain", "$timeout", "localStorageService", "Mall.Value", "GoogleAnalyticsUtility", function (n, t, i, r, u, f, e, o, s) {
                return {
                    restrict: "EA",
                    templateUrl: "/V2/TypeScripts/Components/ns-search/search.html",
                    scope: {ngModel: "=?", nsPosition: "@?"},
                    link: function (h) {
                        var c = /^service./i;
                        h.search = {
                            keyWord: "",
                            keyWordList: [],
                            historyKeyWordList: [],
                            maxHistoryKeyWordLength: 15,
                            maxKeyWordLength: 10,
                            maxDisplayHistoryLength: 3,
                            keyCodeTransform: {38: "up", 40: "down"},
                            selectIndex: -2,
                            keyTimes: 0,
                            timeDisposer: undefined,
                            showListType: "",
                            delayTime: 800,
                            clickItem: function (n) {
                                this.keyWord = n;
                                this.keyWordList = [];
                                this.doSearch()
                            },
                            doSearch: function () {
                                var i, t;
                                if (h.TrackSearchEvent(), h.search.keyWord && h.search.keyWord !== "") {
                                    if (c.test(n.location.hostname)) {
                                        n.location.href = u + "/v2/Search?q=" + encodeURIComponent(h.search.keyWord) + "&shopId=" + r;
                                        return
                                    }
                                    if (e.isSupported) {
                                        if (h.search.historyKeyWordList = e.get("SearchHistoryKeyWord") || [], h.search.historyKeyWordList.length !== 0) {
                                            for (i = -1, t = 0; t < h.search.historyKeyWordList.length; t++)h.search.historyKeyWordList[t].text === h.search.keyWord && (i = t);
                                            i !== -1 && h.search.historyKeyWordList.splice(i, 1)
                                        }
                                        h.search.historyKeyWordList.unshift({
                                            type: "history",
                                            text: h.search.keyWord,
                                            selected: !1
                                        });
                                        h.search.historyKeyWordList.length > h.search.maxHistoryKeyWordLength && h.search.historyKeyWordList.splice(h.search.maxHistoryKeyWordLength, 1);
                                        e.set("SearchHistoryKeyWord", h.search.historyKeyWordList)
                                    }
                                    n.location.href = u + "/v2/Search?q=" + encodeURIComponent(h.search.keyWord) + "&shopId=" + r
                                }
                            },
                            getKeyWords: function () {
                                if (this.timeDisposer && f.cancel(this.timeDisposer), this.selectIndex = -2, h.search.keyWord === "") {
                                    h.search.keyWordList = [];
                                    h.search.getHistoryKeyWord();
                                    return
                                }
                                if (h.search.keyWord.length > 100 && (h.search.keyWord = h.search.keyWord.substr(0, 100)), h.search.showListType = "both", h.search.keyWordList = [], _.each(h.search.historyKeyWordList, function (n) {
                                        if (n.text && n.text.indexOf(h.search.keyWord) !== -1) {
                                            var t = h.MatchKeywordHTML(n.text);
                                            h.search.keyWordList.unshift({
                                                type: "history",
                                                text: n.text,
                                                selected: !1,
                                                displayText: t
                                            })
                                        }
                                    }), h.search.keyWordList.length >= 10) {
                                    h.search.keyWordList.slice(0, 10);
                                    return
                                }
                                this.timeDisposer = f(function () {
                                    i.GetShopSalePageTermListByKeyword(h.search.keyWord).then(function (n) {
                                        _.each(n, function (n) {
                                            var t = !0, i;
                                            _.each(h.search.keyWordList, function (i) {
                                                i.text == n.SalePageTermText && (t = !1)
                                            });
                                            t && (i = h.MatchKeywordHTML(n.SalePageTermText), h.search.keyWordList.push({
                                                type: "key",
                                                text: n.SalePageTermText,
                                                selected: !1,
                                                displayText: i
                                            }))
                                        })
                                    })
                                }, h.search.delayTime)
                            },
                            selectAutoCompleteItem: function (n) {
                                n.stopPropagation();
                                n.bubbles = !1;
                                n.keyCode === 13 && (n.preventDefault(), this.keyTimes % 2 == 0 && (h.search.selectIndex >= 0 ? h.TrackEvent("Header_搜尋", "click", "搜尋-AutoComplete") : h.TrackSearchEvent(), this.doSearch()), this.keyTimes += 1);
                                var t = this.keyCodeTransform[n.keyCode];
                                t && this.switchSelectedItem(t)
                            },
                            switchSelectedItem: function (n) {
                                this.doSwitchItem(n)
                            },
                            doSwitchItem: function (n) {
                                if (this.keyWordList.length !== 0) {
                                    if (n && this.keyTimes % 2 == 0) {
                                        if (this.selectIndex < 0) {
                                            this.selectIndex += 1;
                                            this.selectIndex === 0 && this.keyWordList.length > 0 && (this.keyWordList[this.selectIndex].selected = !0, this.keyWord = this.keyWordList[this.selectIndex].text);
                                            return
                                        }
                                        this.keyWordList[this.selectIndex].selected = !1;
                                        n === "down" ? this.selectIndex < this.keyWordList.length - 1 ? this.selectIndex += 1 : this.selectIndex = 0 : this.selectIndex > 0 ? this.selectIndex -= 1 : this.selectIndex = this.keyWordList.length - 1;
                                        this.keyTimes += 1;
                                        this.keyWordList[this.selectIndex].selected = !0;
                                        this.keyWord = this.keyWordList[this.selectIndex].text;
                                        return
                                    }
                                    this.keyTimes += 1
                                }
                            },
                            focusSearchBar: function (n) {
                                n ? (h.nsPosition === "header" && h.TrackEvent("全站_Header", "搜尋", "Focus"), h.search.keyWord !== "" ? h.search.getKeyWords() : h.search.getHistoryKeyWord()) : h.isDesktop && f(function () {
                                        h.search.showListType = ""
                                    }, 200)
                            },
                            getHistoryKeyWord: function () {
                                (h.search.historyKeyWordList = [], c.test(n.location.hostname)) || (e.isSupported && (h.search.historyKeyWordList = e.get("SearchHistoryKeyWord") || []), h.search.keyWordList = h.search.historyKeyWordList, h.search.showListType = "history")
                            }
                        };
                        h.isDesktop = o.deviceSize === "pc";
                        h.$watch("ngModel", function (n, t) {
                            h.ngModel ? h.search.keyWord = h.ngModel : n !== t && (h.search.keyWord = h.ngModel)
                        });
                        h.MatchKeywordHTML = function (n) {
                            var i = n.replace(h.search.keyWord, "<b>" + h.search.keyWord + "<\/b>");
                            return t.trustAsHtml(i)
                        };
                        h.TrackEvent = function (n, t, i) {
                            s.TrackEvent(n, t, i)
                        };
                        h.TrackSearchEvent = function () {
                            h.nsPosition === "header" && h.TrackEvent("全站_Header", "搜尋", "Search")
                        }
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function () {
            var t = n.Mall.Models.PageNameEnum;
            angular.module("NineYi.Mall.Directives").directive("nsBrowsingHistory", ["$log", "Mall.Value", "PageValue", "$window", "$timeout", "ShoppingCartUtility", "SalePageService", "ShopId", "GoogleAnalyticsEcommerceUtility", "GoogleAnalyticsUtility", "CookieUtility", "FacebookUtility", function (n, i, r, u, f, e, o, s, h, c, l, a) {
                return {
                    restrict: "EA",
                    templateUrl: "/V2/TypeScripts/Components/ns-browsing-history/browsingHistory.html",
                    scope: {},
                    link: function (u, f) {
                        function b() {
                            var n = l.GetCookie("salePageViewList");
                            o.GetSalePageDataByIds(n).then(function (n) {
                                u.salePageViewList = [];
                                n && (u.salePageViewList = n.reverse())
                            })
                        }

                        function k(n, t) {
                            n && (n.style.transform = "translate3d(0, " + t + "px, 0)", n.style["-webkit-transform"] = "translate3d(0, " + t + "px, 0)", n.style["-moz-transform"] = "translate3d(0, " + t + "px, 0)", n.style["-ms-transform"] = "translate3d(0, " + t + "px, 0)")
                        }

                        function g(n, t) {
                            n && (n.style.transition = "transform " + t)
                        }

                        function d(n, t, i) {
                            var u = r.CurrentPageName;
                            u !== "" && c.TrackEvent(n, t, u + "-" + i)
                        }

                        var h, y, v, p, w;
                        u.gaReferSrc = "garefersrc=BrowseHistory";
                        u.showDetail = !1;
                        u.isDesktop = i.deviceSize === "pc";
                        u.showMenu = u.isDesktop;
                        u.shopId = s;
                        u.currentIndex = 0;
                        u.browsingMenuCount = 3;
                        p = 93;
                        u.isDesktop && b();
                        u.isDesktop || (w = r.CurrentPage, w == t.SalePageIndex && f[0].querySelector(".browsing-header").setAttribute("style", "bottom:130px"));
                        u.$on("onRepeatEnd", function () {
                            u.initSetting()
                        });
                        u.initSetting = function () {
                            u.currentIndex = 0;
                            h = f[0].querySelector(".browsing-menu-ul");
                            p = f[0].querySelector(".browsing-menu-li").getBoundingClientRect().height;
                            n.debug("componentsHeight, " + p);
                            y = p * u.browsingMenuCount;
                            n.debug("containerHeight, " + y);
                            f[0].querySelector(".menu-frame").setAttribute("style", "max-height:" + y + "px");
                            v = 0;
                            k(h, v)
                        };
                        u.switchMenu = function () {
                            u.isDesktop ? u.showMenu = !u.showMenu : (u.showMenu = !u.showMenu, u.showMenu && (d("瀏覽紀錄", "click", "展開瀏覽紀錄"), u.salePageViewList || b()))
                        };
                        u.scrollDown = function () {
                            u.scroll(!1)
                        };
                        u.scrollUp = function () {
                            u.scroll(!0)
                        };
                        u.scroll = function (n) {
                            if (!(u.salePageViewList.length <= u.browsingMenuCount)) {
                                var i = !n, t = 1;
                                (i && (t = -1), n && u.currentIndex - u.browsingMenuCount < 0) || i && u.currentIndex + u.browsingMenuCount >= u.salePageViewList.length || (u.currentIndex = u.currentIndex - t * u.browsingMenuCount, g(h, "0.8s"), v = v + t * y, k(h, v))
                            }
                        };
                        u.hoverDetailFunction = function (n) {
                            var t = f[0].querySelector(".browsing-body-desktop .menu-frame");
                            return n ? t.classList.add("extand-width") : t.classList.remove("extand-width"), n
                        };
                        u.addToCart = function (n, t, i) {
                            a.TrackAddToCartEvent([n.toString()], "", i, t);
                            d("瀏覽紀錄", "click", "加入購物車");
                            e.AddToCart(n, this.shopId, null, null, "瀏覽紀錄").then(function (n) {
                                if (n) {
                                    e.AddToCartResult(n, 750, !1);
                                    return
                                }
                                e.AddToCartResult("加入成功", 750, !0)
                            })
                        };
                        u.clearHistory = function () {
                            h && h.style.removeProperty("transition");
                            var n = new Date;
                            document.cookie = "salePageViewList=;expires=" + n.toUTCString() + ";path=/";
                            u.salePageViewList = [];
                            u.currentIndex = 0
                        };
                        u.TrackEvent = function (n, t, i) {
                            c.TrackEvent(n, t, i)
                        }
                    }
                }
            }])
        })(i = t.Directives || (t.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    var r = this;
                    this.$log = n;
                    this.$timeout = t;
                    this.FreezeBodyUtility = i;
                    this.restrict = "EA";
                    this.replace = !0;
                    this.scope = {
                        IsOpen: "=nsIsOpen",
                        OpenDirection: "=?nsOpenDirection",
                        ShowClose: "=?nsShowClose",
                        PageCaption: "=?nsPageCaption",
                        CloseFunction: "&?nsCloseFunction"
                    };
                    this.transclude = !0;
                    this.templateUrl = "/V2/TypeScripts/Components/ns-push-half-page/pushHalfPage.html";
                    this.link = function (n, t) {
                        var f = t[0], e = angular.element(f.querySelector(".half-page-background")), u, i;
                        n.OpenDirection = n.OpenDirection || "left";
                        u = angular.element(f.querySelector(".half-page-container"));
                        n.OpenDirection === "right" || n.OpenDirection === "left" ? u.addClass("horizontal-container") : u.addClass("vertical-container");
                        i = f.querySelector(".half-page-container");
                        n.DetectScrollTop = function () {
                            var n = i.scrollTop, t = i.scrollHeight, r = n + i.offsetHeight;
                            n === 0 ? i.scrollTop = 1 : r === t && (i.scrollTop = n - 1)
                        };
                        n.$watch(function () {
                            return n.IsOpen
                        }, function (t) {
                            t ? (e.addClass("open-mask"), u.removeClass("close-" + n.OpenDirection), u.addClass("open-" + n.OpenDirection), r.FreezeBodyUtility.FreezeBody(), i.addEventListener("touchstart", n.DetectScrollTop)) : (e.removeClass("open-mask"), u.removeClass("open-" + n.OpenDirection), u.addClass("close-" + n.OpenDirection), r.FreezeBodyUtility.UnFreezeBody(), i.removeEventListener("touchstart", n.DetectScrollTop))
                        });
                        r.$timeout(function () {
                            n.IsLoad = !0
                        });
                        n.ClosePage = function () {
                            n.IsOpen = !1;
                            n.CloseFunction()
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$log", "$timeout", "FreezeBodyUtility"], t
                }, n
            }();
            n.PushHalfPageDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsPushHalfPage", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsFixedAside", ["$window", function (n) {
                return {
                    restrict: "AC", link: function (t, i, r) {
                        var u = 768, f = n.innerWidth, e = function () {
                            function g() {
                                if (n.innerWidth >= u) {
                                    if (o = t.clientHeight, f = t.getBoundingClientRect(), s = document.querySelector(r.competitor), l = s && s.clientHeight, e = n.innerHeight, h = n.scrollY || n.pageYOffset, w = s.parentElement.offsetTop, s && o >= l)return y(), o - e + f.top <= 0 && (t.style.marginBottom = a + "px"), !0;
                                    var i = !!document.querySelector(".is-loading");
                                    !v && !i && h > o - e ? (f.height >= e && f.bottom <= e || f.height < e && +f.top <= 0) && (f.height < e && (p = document.querySelector("#officialHeader").getBoundingClientRect().height), c || (c = f.height - f.bottom + w), v = !0, t.classList.add("fixed-aside"), t.removeAttribute("style"), t.style.width = f.width + "px", o <= e - a ? t.style.top = p + "px" : t.style.bottom = a + "px") : o > e ? h <= o - e + w && y() : h <= c && y()
                                }
                                n.scrollY == 0 && y()
                            }

                            function k() {
                                o = t.clientHeight;
                                f = t.getBoundingClientRect();
                                p = t.getBoundingClientRect().top;
                                s = document.querySelector(r.competitor);
                                l = s && s.clientHeight;
                                d = document.querySelector(".layout-header");
                                b = document.querySelector(".layout-footer");
                                a = b.clientHeight;
                                h = 0;
                                v = !1;
                                c = null;
                                e = n.innerHeight
                            }

                            function y() {
                                v = !1;
                                c = null;
                                t.classList.remove("fixed-aside");
                                t.removeAttribute("style")
                            }

                            var t = i[0], o, f, p, s, l, w, d, b, a, h, v, c, e;
                            return k(), {
                                needFix: function () {
                                    if (o < l)return !0
                                }, init: function () {
                                    k()
                                }, bindAffix: function () {
                                    n.innerWidth >= u && n.addEventListener("scroll", g)
                                }
                            }
                        }().bindAffix();
                        n.addEventListener("resize", function () {
                            n.innerWidth !== f && n.scrollTo(0, 0)
                        })
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsHotKeywordSearch", ["$window", "SearchService", "ShopId", "OfficialOriginDomain", "$timeout", "Mall.Value", "GoogleAnalyticsUtility", function (n, t, i, r, u, f, e) {
                return {
                    restrict: "E",
                    templateUrl: "/V2/TypeScripts/Components/ns-hot-keyword-search/hotKeywordSearch.html",
                    scope: {gaCategory: "@?nsGaCategory", gaLabel: "@?nsGaLabel", hasCallApi: "=?nsCallApi"},
                    link: function (u) {
                        u.shopId = i;
                        u.hotKeywordList = [];
                        u.$watch("hasCallApi", function (n) {
                            n || u.hotKeywordList.length !== 0 || t.GetShopHotKeywordList(i).then(function (n) {
                                u.hotKeywordList = n.Data
                            })
                        });
                        u.hrefTo = function (t) {
                            n.location.href = r + "/v2/Search?q=" + encodeURIComponent(t) + "&shopId=" + i;
                            u.gaCategory && u.gaCategory !== "" && u.gaLabel && u.gaLabel !== "" && e.TrackEvent(u.gaCategory, "click", u.gaLabel)
                        }
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function () {
            angular.module("NineYi.Mall.Directives").directive("nsSetClassByLink", ["$window", function (n) {
                return {
                    restrict: "A", link: function (t, i, r) {
                        var p = n.location.search.replace("?", "").split("&"), h = "", e, c, u, o, y;
                        p.forEach(function (n) {
                            n.toString().match(/ga/g) || (h += n)
                        });
                        h !== "" && (h = "?" + h);
                        var a = n.location.pathname + h, w = a.split("/")[1], v = r.className, l = i.find("a");
                        for (u = 0; u < l.length; u++) {
                            var o = angular.element(l[u]), b = o.attr("href"), s = b.split("/"), f = s.pop();
                            if (s[0] === "")for (e = 0; e < s.length; e++)c = s.pop(), f = c + "/" + f; else for (e = 2; e < s.length; e++)c = s.pop(), f = c + "/" + f;
                            if (f = "/" + f, f.toUpperCase() === a.toUpperCase()) {
                                o.addClass(v);
                                return
                            }
                        }
                        for (u = 0; u < l.length; u++)if (o = angular.element(l[u]), y = o.attr("href").split("/")[1], y.toUpperCase() === w.toUpperCase()) {
                            o.addClass(v);
                            return
                        }
                    }
                }
            }])
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f) {
                    this.$q = n;
                    this.ShopId = t;
                    this.PageValue = i;
                    this.ShoppingCartUtility = r;
                    this.SalePageService = u;
                    this.CookieUtility = f
                }

                return n.prototype.GetSalePageViewList = function () {
                    var t = [], n = this.$q.defer(), i = this.CookieUtility.GetCookie("salePageViewList");
                    return i ? this.SalePageService.GetSalePageDataByIds(i).then(function (i) {
                            i && (t = i.reverse());
                            n.resolve(t)
                        }, function () {
                            n.reject()
                        }) : n.resolve(t), n.promise
                }, n.prototype.AddToCart = function (n) {
                    var t = this;
                    this.ShoppingCartUtility.AddToCart(n, this.ShopId, null, null, "瀏覽紀錄").then(function (n) {
                        if (n) {
                            t.ShoppingCartUtility.AddToCartResult(n, 750, !1);
                            return
                        }
                        t.ShoppingCartUtility.AddToCartResult("加入成功", 750, !0)
                    })
                }, n.prototype.ClearBrowsingHistory = function () {
                    var n = new Date;
                    document.cookie = "salePageViewList=;expires=" + n.toUTCString() + ";path=/"
                }, n.$inject = ["$q", "ShopId", "PageValue", "ShoppingCartUtility", "SalePageService", "CookieUtility"], n
            }();
            n.BrowsingHistoryUtility = t;
            angular.module("NineYi.Mall.Directives").service("BrowsingHistoryUtility", t)
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i) {
                    this.$log = n;
                    this.$window = t;
                    this.$timeout = i;
                    this.restrict = "AE";
                    this.templateUrl = "/V2/TypeScripts/Components/ns-tool-box/toolBoxDirective.html";
                    this.transclude = !0;
                    this.controller = "ToolBoxDirectiveController";
                    this.controllerAs = "ToolBoxDirectiveCtrl"
                }

                return n.factory = function () {
                    var t = function (t, i, r) {
                        return new n(t, i, r)
                    };
                    return t.$inject = ["$log", "$window", "$timeout"], t
                }, n
            }();
            n.ToolBoxDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsToolBox", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(t, i, r, u, f, e, o, s, h, c, l, a, v, y, p, w, b) {
                    var k = this;
                    this.$scope = t;
                    this.$element = i;
                    this.$log = r;
                    this.$window = u;
                    this.$timeout = f;
                    this.$sce = e;
                    this.shopId = o;
                    this.officialShopProfile = s;
                    this.couponServiceImmediate = h;
                    this.BrowsingHistoryUtility = c;
                    this.FBMessengerUtility = l;
                    this.LineUtility = a;
                    this.ElementUtility = v;
                    this.FacebookUtility = y;
                    this.AnimeUtility = p;
                    this.ShopInstagramUrl = w;
                    this.$q = b;
                    this.currentPage = 1;
                    this.totalPage = 0;
                    this.HeaderHeight = 0;
                    this.MainVisionPicHeight = 0;
                    this.HeaderTopHeight = 0;
                    this.CarouselHeight = 0;
                    this.scrollDistance = 0;
                    this.singlePageHeight = 0;
                    this.ShopId = this.shopId;
                    this.gaReferSrc = "garefersrc=BrowseHistory";
                    this.FBMessenger = this.FBMessengerUtility.FBMessenger;
                    this.IsFBMessengerServiceTime = this.FBMessengerUtility.IsFBMessengerServiceTime();
                    this.FanGroupUrl = this.FBMessengerUtility.FanGroupUrlString;
                    this.LineUrl = this.LineUtility.lineUrl;
                    this.officialShopProfile && this.officialShopProfile.BrowserMode === n.WebStore.Frontend.BE.Device.DeviceModeEnum.Desktop && (this.DetectScrollHeight(), this.$timeout(function () {
                        k.InitBrowsingHistoryData()
                    }));
                    this.checkHasCoupon();
                    this.HasStoreInfo = this.officialShopProfile.StoreTotalCount > 0
                }

                return t.prototype.checkHasCoupon = function () {
                    var n = this;
                    this.couponServiceImmediate.GetCouponListPromise.then(function (t) {
                        n.HasCoupon = t.length > 0
                    })
                }, t.prototype.DetectScrollHeight = function () {
                    var n = this, t;
                    this.MainVisionPicElement = document.getElementById("mainVisionPic");
                    this.CarouselElement = document.getElementsByClassName("indexCarousel")[0];
                    this.CarouselPicElement = this.CarouselElement ? this.CarouselElement.querySelector("img") : this.CarouselPicElement;
                    this.HeaderTopElement = document.getElementById("header-top");
                    this.HeaderElement = document.getElementById("officialHeader");
                    this.ToolBoxElem = this.$element[0].querySelector("#ns-tool-box");
                    this.HeaderTopHeight = this.HeaderTopElement ? this.HeaderTopElement.clientHeight : 0;
                    this.HeaderHeight = this.HeaderElement ? this.HeaderElement.clientHeight : 0;
                    t = 55;
                    this.$q.all([this.GetMainVisionImageHeight(), this.GetCarouselImageHeight()]).then(function (i) {
                        var r = 0;
                        i.forEach(function (n) {
                            r += n
                        });
                        r = r + n.HeaderHeight + t;
                        n.IsLoaded = !0;
                        n.AdjustToolBoxPosition(r);
                        n.AddScrollEvent(t)
                    })
                }, t.prototype.GetMainVisionImageHeight = function () {
                    var n = this, t = this.$q.defer();
                    return this.MainVisionPicElement && !this.MainVisionPicElement.complete ? this.MainVisionPicElement.onload = function () {
                            n.MainVisionPicHeight = n.MainVisionPicElement.height;
                            t.resolve(n.MainVisionPicHeight)
                        } : (this.MainVisionPicHeight = this.MainVisionPicElement ? this.MainVisionPicElement.height : 0, t.resolve(this.MainVisionPicHeight)), t.promise
                }, t.prototype.GetCarouselImageHeight = function () {
                    var n = this, t = this.$q.defer();
                    return this.CarouselPicElement && !this.CarouselPicElement.complete ? this.CarouselPicElement.onload = function () {
                            n.hasLoadCarouselPic || (n.CarouselHeight = n.CarouselElement.clientHeight, n.hasLoadCarouselPic = !0, t.resolve(n.CarouselHeight))
                        } : (this.CarouselHeight = this.CarouselPicElement ? this.CarouselElement.clientHeight : 0, t.resolve(this.CarouselHeight)), t.promise
                }, t.prototype.AddScrollEvent = function (n) {
                    var t = this;
                    window.addEventListener("scroll", function () {
                        window.pageYOffset <= t.HeaderTopHeight + t.MainVisionPicHeight + t.CarouselHeight ? t.AdjustToolBoxPosition(t.HeaderHeight + t.MainVisionPicHeight + t.CarouselHeight - window.pageYOffset + n) : t.AdjustToolBoxPosition(n + t.HeaderTopHeight)
                    })
                }, t.prototype.AdjustToolBoxPosition = function (n) {
                    this.ToolBoxElem && (this.ToolBoxElem.style.top = n + "px")
                }, t.prototype.SwitchFBMessenger = function () {
                    this.showMessenger = !this.showMessenger;
                    this.hasShowMessage || (this.FBMessengerIframeSrc = this.$sce.trustAsResourceUrl(this.FBMessengerUtility.GetFBMessengerSrc()));
                    this.hasShowMessage = !0
                }, t.prototype.ConfirmQuestionService = function () {
                    this.FBMessengerUtility.ConfirmQuestionService()
                }, t.prototype.clearHistory = function () {
                    this.BrowsingHistoryUtility.ClearBrowsingHistory();
                    this.salePageViewList = []
                }, t.prototype.InitBrowsingHistoryData = function () {
                    var n = this;
                    this.GetSalePageViewList();
                    this.$scope.$on("onRepeatEnd", function () {
                        n.InitBrowsingHistorySetting()
                    })
                }, t.prototype.GetSalePageViewList = function () {
                    var n = this;
                    this.$log.info("Get SalePageViewList - Start");
                    this.BrowsingHistoryUtility.GetSalePageViewList().then(function (t) {
                        n.salePageViewList = t;
                        n.$log.info("Get SalePageViewList - Finish")
                    })
                }, t.prototype.InitBrowsingHistorySetting = function () {
                    if (this.browsingMenuFrame = this.$element[0].querySelector(".browsing-menu-frame"), this.browsingMenuUlElement = this.$element[0].querySelector(".browsing-menu-ul"), this.browsingMenuLiElement = this.$element[0].querySelector(".browsing-menu-li"), this.browsingMenuLiElement && this.browsingMenuUlElement) {
                        this.browsingMenuLiHeight = this.ElementUtility.getElementOffset(this.browsingMenuLiElement).height;
                        var n = this.ElementUtility.getElementOffset(this.browsingMenuUlElement).height;
                        this.singlePageHeight = this.browsingMenuLiHeight * 3;
                        this.totalPage = Math.ceil(n / this.singlePageHeight);
                        this.AnimeUtility.Translate3d(this.browsingMenuUlElement, this.scrollDistance)
                    }
                }, t.prototype.BrowsingHistoryScrollUp = function () {
                    this.currentPage <= 1 || (this.scrollDistance = this.scrollDistance + this.singlePageHeight, this.AnimeUtility.Translate3d(this.browsingMenuUlElement, this.scrollDistance), this.currentPage -= 1)
                }, t.prototype.BrowsingHistoryScrollDown = function () {
                    this.currentPage >= this.totalPage || (this.scrollDistance = this.scrollDistance - this.singlePageHeight, this.AnimeUtility.Translate3d(this.browsingMenuUlElement, this.scrollDistance), this.currentPage += 1)
                }, t.$inject = ["$scope", "$element", "$log", "$window", "$timeout", "$sce", "ShopId", "OfficialShopProfile", "CouponServiceImmediate", "BrowsingHistoryUtility", "FBMessengerUtility", "LineUtility", "ElementUtility", "FacebookUtility", "AnimeUtility", "ShopInstagramUrl", "$q"], t
            }();
            t.ToolBoxDirectiveController = i;
            angular.module("NineYi.Mall.Directives").controller("ToolBoxDirectiveController", i)
        })(i = t.Directives || (t.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f, e, o) {
                    var s = this;
                    this.$log = n;
                    this.$q = t;
                    this.$window = i;
                    this.$timeout = r;
                    this.shopId = u;
                    this.BrowsingHistoryUtility = f;
                    this.FBMessengerUtility = e;
                    this.FacebookUtility = o;
                    this.restrict = "AE";
                    this.templateUrl = "/V2/TypeScripts/Components/ns-tool-box/toolBoxFloatingIconDirective.html";
                    this.transclude = !0;
                    this.link = function (n) {
                        n.gaReferSrc = "garefersrc=BrowseHistory";
                        n.ShopId = s.shopId;
                        n.FBName = s.FBMessengerUtility.FBFanName;
                        n.FBMessenger = s.FBMessengerUtility.FBMessenger;
                        n.IsFBMessengerServiceTime = s.FBMessengerUtility.IsFBMessengerServiceTime();
                        n.SwitchBrowsingHistory = function () {
                            n.IsOpenBrowsingHistory = !n.IsOpenBrowsingHistory;
                            n.hasInitBrowsingHistory || n.GetSalePageViewList()
                        };
                        n.SendFBEvent = function (n, t, i) {
                            s.FacebookUtility.TrackAddToCartEvent([n.toString()], "", i, t)
                        };
                        n.addToCart = function (n, t, i) {
                            f.AddToCart(n, t, i)
                        };
                        n.clearHistory = function () {
                            f.ClearBrowsingHistory();
                            n.salePageViewList = []
                        };
                        n.ConfirmQuestionService = function () {
                            s.FBMessengerUtility.ConfirmQuestionService()
                        };
                        n.GetSalePageViewList = function () {
                            s.$log.info("Get SalePageViewList - Start");
                            n.hasInitBrowsingHistory = !0;
                            f.GetSalePageViewList().then(function (t) {
                                n.salePageViewList = t;
                                s.$log.info("Get SalePageViewList - Finish")
                            })
                        }
                    }
                }

                return n.factory = function () {
                    var t = function (t, i, r, u, f, e, o, s) {
                        return new n(t, i, r, u, f, e, o, s)
                    };
                    return t.$inject = ["$log", "$q", "$window", "$timeout", "ShopId", "BrowsingHistoryUtility", "FBMessengerUtility", "FacebookUtility"], t
                }, n
            }();
            n.ToolBoxFloatingIconDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsToolBoxFloatingIcon", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n() {
                    this.scope = {ShopCategoryListInfo: "=nsShopCategoryListInfo", FreeGiftList: "=nsFreeGiftList"};
                    this.restrict = "EA";
                    this.templateUrl = "/V2/TypeScripts/Components/ns-header-category-menu/headerCategoryMenuDirective.html";
                    this.controller = "HeaderCategoryMenuDirectiveController";
                    this.controllerAs = "HeaderCategoryMenuDirectiveCtrl"
                }

                return n.factory = function () {
                    return function () {
                        return new n
                    }
                }, n
            }();
            n.HeaderCategoryMenuDirective = t;
            angular.module("NineYi.Mall.Directives").directive("nsHeaderCategoryMenu", t.factory())
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f) {
                    var o = this, e;
                    this.$scope = n;
                    this.$element = t;
                    this.$log = i;
                    this.officialOriginDomain = r;
                    this.googleAnalyticsUtility = u;
                    this.$timeout = f;
                    this.IsOpenCategoryLevel2 = !1;
                    this.PerGroupLength = 14;
                    this.GroupCountLimit = 4;
                    this.$MenuElem = t[0];
                    e = this.$scope.$watchGroup(["ShopCategoryListInfo", "FreeGiftList"], function (n, t) {
                        typeof n != "undefined" && n !== t && (o.InitialCategoryMenuSetting(), e())
                    })
                }

                return n.prototype.OpenLevel1Category = function (n, t, i) {
                    var u = n.ChildList, f, r;
                    n.ChildListCount > 0 && u.length > 0 ? (this.IsOpenCategoryLevel2 = !0, this.SelectedCategoryListLevel1 = n, this.SelectedGroupNumber = i, this.SelectedGroupedCategoryListLevel1 = t, f = this.PerGroupLength - 1, this.GroupedCategoryListLevel2 = this.GetSplitedCategoryGroup(f, u), r = this.GroupedCategoryListLevel2.length + 1, this.SelectedGroupNumber < r && (this.ListWidth = this.GetMenuWidth(r)), this.IsEnableLevel2Slide = r - 1 > this.GroupCountLimit - 1) : window.location.href = this.GetCategoryLink(n.Id);
                    this.googleAnalyticsUtility.TrackEvent("全站_Header", "商品分類", "Menu_Click")
                }, n.prototype.OnEnterMenu = function () {
                    this.$timeout.cancel(this.DelayTimer);
                    this.$MenuElem.classList.add("show-menu")
                }, n.prototype.OnLeaveMenu = function () {
                    var n = this;
                    this.DelayTimer = this.$timeout(function () {
                        n.$MenuElem.classList.remove("show-menu")
                    }, 500)
                }, n.prototype.OpenLevel2Category = function (n) {
                    window.location.href = this.GetCategoryLink(n.Id);
                    this.googleAnalyticsUtility.TrackEvent("全站_Header", "商品分類", "Menu_Click")
                }, n.prototype.CloseLevel2Category = function () {
                    this.IsOpenCategoryLevel2 = !1;
                    this.SelectedGroupNumber = 0;
                    this.ListWidth = this.Level1ListWidth;
                    this.googleAnalyticsUtility.TrackEvent("全站_Header", "商品分類", "Back")
                }, n.prototype.HasFreeGift = function (n) {
                    return this.$scope.FreeGiftList.indexOf(n.Id) >= 0
                }, n.prototype.GetCategoryLink = function (n) {
                    return this.officialOriginDomain + "/v2/official/SalePageCategory/" + n
                }, n.prototype.InitialCategoryMenuSetting = function () {
                    var n = this.$scope.ShopCategoryListInfo, t = n.Count, u = n.MaxChildListCount, i = this.PerGroupLength, r = Math.ceil(t / i);
                    this.Level1ListWidth = this.ListWidth = this.GetMenuWidth(r);
                    this.ListHeight = this.GetMenuHeight(t, u);
                    this.IsEnableLevel1Slide = r > this.GroupCountLimit;
                    this.GroupedCategoryListLevel1 = this.GetSplitedCategoryGroup(i, n.List)
                }, n.prototype.GetMenuHeight = function (n, t) {
                    var i = n > t ? n : t, r = i > this.PerGroupLength ? this.PerGroupLength : i + 1;
                    return r * 30 + 30 + "px"
                }, n.prototype.GetMenuWidth = function (n) {
                    var t = n > this.GroupCountLimit ? this.GroupCountLimit : n;
                    return t * 300 + "px"
                }, n.prototype.GetSplitedCategoryGroup = function (n, t) {
                    var r = [], i;
                    if (typeof t != "undefined")for (i = 0; i <= t.length - 1; i += n)r.push(t.slice(i, i + n));
                    return r
                }, n.$inject = ["$scope", "$element", "$log", "OfficialOriginDomain", "GoogleAnalyticsUtility", "$timeout"], n
            }();
            n.HeaderCategoryMenuDirectiveController = t;
            angular.module("NineYi.Mall.Directives").controller("HeaderCategoryMenuDirectiveController", t)
        })(t = n.Directives || (n.Directives = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n) {
                    this.model = n;
                    this.model.StartDateTime = this.model.StartDateTime ? new Date(parseInt(this.model.StartDateTime.replace("/Date(", "").replace(")/", ""), 10)) : null;
                    this.model.EndDateTime = this.model.EndDateTime ? new Date(parseInt(this.model.EndDateTime.replace("/Date(", "").replace(")/", ""), 10)) : null
                }

                return t.prototype.getTypeDef = function () {
                    return this.model.TypeDef ? n.Mall.Mixin.PromotionConditionTypeDisplayEnum(this.model.TypeDef) : null
                }, t.prototype.getCRMMemberTierName = function () {
                    var n = "";
                    return this.isCRMMemberTier() && (n = this.model.PromotionTargetMemberTierList[0].CrmShopMemberCardName), n
                }, t.prototype.isProcessing = function () {
                    var n = new Date;
                    return this.model.StartDateTime && this.model.EndDateTime ? this.model.StartDateTime <= n && this.model.EndDateTime >= n : !1
                }, t.prototype.isNewest = function () {
                    var n = new Date;
                    return this.model.StartDateTime && this.model.StartDateTime <= n ? Date.now() - this.model.StartDateTime.getTime() <= 864e5 : !1
                }, t.prototype.isComingToEnd = function () {
                    var n = new Date;
                    return this.model.EndDateTime && this.model.EndDateTime >= n ? this.model.EndDateTime.getTime() - Date.now() <= 864e5 : !1
                }, t.prototype.isCRMMemberTier = function () {
                    var n = !1;
                    return this.model.TypeDef === "CrmMemberTierTotalPrice" && this.model.PromotionTargetMemberTierList.length > 0 && (n = !0), n
                }, t
            }();
            t.PromotionListClass = i
        })(i = t.BL || (t.BL = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            function i(t) {
                var i = {
                    TotalPrice: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.TotalPrice,
                    TotalQty: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.TotalQty,
                    ReachQty: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.ReachQty,
                    TotalPriceV2: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.TotalPriceV2,
                    TotalQtyV2: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.TotalQtyV2,
                    CrmMemberTierTotalPrice: n.WebStore.Frontend.BE.Promotion.PromotionConditionTypeV2Enum.CrmMemberTierTotalPrice
                };
                return t ? i[t] : t
            }

            t.PromotionConditionTypeDisplayEnum = i
        })(i = t.Mixin || (t.Mixin = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (t) {
        var i;
        (function (t) {
            var i = function () {
                function t(n, t, i, r, u, f, e, o, s, h, c, l, a, v, y, p, w, b, k) {
                    var d = this;
                    this.$rootScope = n;
                    this.$scope = t;
                    this.$location = i;
                    this.$window = r;
                    this.$log = u;
                    this.$q = f;
                    this.$timeout = e;
                    this.$modalInstance = o;
                    this._ = s;
                    this.SalePageService = h;
                    this.ShoppingCartService = c;
                    this.ProductStockService = l;
                    this.addToCartConfig = a;
                    this.Facebook = v;
                    this.GoogleAnalyticsEcommerceUtility = y;
                    this.GoogleTagManagerDataLayerUtility = p;
                    this.FacebookUtility = w;
                    this.PageValue = b;
                    this.DeviceValue = k;
                    this.IsWaiting = !1;
                    this.SelectedSKUProperty = [];
                    this.SKULevel = 0;
                    this.SKUTitle = "";
                    this.IsInitialed = !1;
                    this.HideBuyButton = !1;
                    this.addToCartResultMessage = this.addToCartConfig.message || "";
                    this.addToCartResult = this.addToCartConfig.isOK;
                    this.CurrentImgSrc = "";
                    this.IsMobile = this.DeviceValue.IsMobile();
                    this.Qty = 1;
                    var g = this.addToCartConfig.salePageId || 0, tt = this.addToCartConfig.shopId || 0, nt = this.addToCartConfig.autoClose || 0;
                    this.chooseItemStageIndex = this.addToCartConfig.chooseSkuItem ? this.addToCartConfig.chooseSkuItem.level : null;
                    this.chooseItemProperty = this.addToCartConfig.chooseSkuItem ? this.addToCartConfig.chooseSkuItem.itemProperty : null;
                    this.soldOutProperty = this.addToCartConfig.chooseSkuItem ? this.addToCartConfig.chooseSkuItem.soldOutProperty : null;
                    this.$log.info("Show add to shoppingCart dialog for salePage ", g);
                    nt !== 0 && this.$timeout(function () {
                        d.$modalInstance.close("ok")
                    }, nt);
                    g !== 0 && tt !== 0 && (this.$log.info("Get SalePage", g, "- Start"), f.all([this.SalePageService.GetSalePage(g), this.SalePageService.GetSalePageStatus(g)]).then(function (n) {
                        d.SalePage = n[0].data;
                        d.SalePage.StatusDef = n[1].data;
                        (d.SalePage.IsAPPOnly || d.SalePage.IsShareToBuy) && (d.HideBuyButton = !0, d.SalePage.IsAPPOnly && d.SalePage.IsShareToBuy && (d.SalePage.IsShareToBuy = !1));
                        d.Initialize()
                    }))
                }

                return t.prototype.Initialize = function () {
                    var n = this;
                    this.SKULevel = this.SalePage.MajorList[0].SKUList.length === 1 ? this.SalePage.MajorList[0].SKUList[0].Title === "-1" ? 0 : 1 : 2;
                    this.$log.debug("SKU Level", this.SKULevel);
                    this.SelectedSKUProperty[0] = this.SalePage.MajorList[0].SKUList[0].PropertyList[0];
                    this.SKULevel === 2 && this.chooseItemStageIndex === 0 && this.chooseItemProperty && (this.SelectedSKUProperty[0] = this.chooseItemProperty);
                    this.SKUDictionaryById = this._.indexBy(this.SalePage.SKUPropertySetList, "SaleProductSKUId");
                    this.SKUDictionaryByPropertyName = this._.indexBy(this.SalePage.SKUPropertySetList, "PropertyNameSet");
                    this.UpdateSKUQty().then(function () {
                        n.IsInitialed = !0;
                        n.SKULevel == 1 && (n.chooseItemProperty ? n.chooseSelectedItem(n.chooseItemStageIndex) : n.PickupDefaultSkuForLevel1());
                        n.SKULevel === 2 && (n.chooseItemProperty ? n.chooseSelectedItem(n.chooseItemStageIndex) : n.PickupDefaultSkuForLevel2());
                        n.CurrentImgSrc = n.GetCurrentImgSrc(n.SelectedSKUProperty);
                        setTimeout(function () {
                            n.scrollToItemPosition()
                        }, 0)
                    });
                    this.SKULevel === 0 && (this.SelectedSKUPropertySet = this.SalePage.SKUPropertySetList[0]);
                    this.SKULevel === 1 && this.$scope.$watch(function () {
                        return n.SelectedSKUProperty[0]
                    }, function (t, i) {
                        if (t !== i) {
                            n.$log.debug("SKU Level 1", t);
                            n.SKUTitle = t.Name;
                            var r = t.PropertyNameSet;
                            n.SelectedSKUPropertySet = n.SKUDictionaryByPropertyName[r]
                        }
                    });
                    this.SKULevel === 2 && (this.$scope.$watch(function () {
                        return n.SelectedSKUProperty[0]
                    }, function (t, i) {
                        t !== i && (n.$log.debug("SKU Level 1", t), n.UpdateSKUQty().then(function () {
                            n.PickupDefaultSkuForLevel2()
                        }))
                    }), this.$scope.$watch(function () {
                        return n.SelectedSKUProperty
                    }, function (t, i) {
                        if (t !== i && t.length > 1) {
                            n.$log.debug("SKU change", t);
                            n.SKUTitle = t[0].Name + "/" + t[1].Name;
                            var r = t[0].PropertyNameSet + ";" + t[1].PropertyNameSet;
                            n.SelectedSKUPropertySet = n.SKUDictionaryByPropertyName[r]
                        }
                    }, !0))
                }, t.prototype.SelectSKUProperty = function (n, t) {
                    this.IsSKUSoldout(n, t) || (this.SelectedSKUProperty[n] = t, this.Qty = 1);
                    n === 0 && (this.CurrentImgSrc = this.GetCurrentImgSrc(this.SelectedSKUProperty))
                }, t.prototype.IsSKUSelected = function (n, t) {
                    var i = this.SelectedSKUProperty[n];
                    return i ? this.SelectedSKUProperty[n].PropertyNameSet === t.PropertyNameSet : !1
                }, t.prototype.IsSKUSoldout = function (n, t) {
                    var i, r;
                    if (this.SKULevel === 1 && (i = t.PropertyNameSet), this.SKULevel === 2) {
                        if (n !== this.SKULevel - 1)return r = !1, this.soldOutProperty && angular.forEach(this.soldOutProperty, function (n) {
                            t.PropertyNameSet === n && (r = !0)
                        }), r;
                        i = this.SelectedSKUProperty[0].PropertyNameSet + ";" + t.PropertyNameSet
                    }
                    return !this.SKUDictionaryByPropertyName || !this.SKUDictionaryByPropertyName[i] || !this.SKUDictionaryByPropertyName[i].hasOwnProperty("SellingQty") ? !0 : this.SKUDictionaryByPropertyName[i].SellingQty <= 0
                }, t.prototype.IsSKUHidden = function (n, t) {
                    var i;
                    if (this.SKULevel === 1 && (i = t.PropertyNameSet), this.SKULevel === 2) {
                        if (n !== this.SKULevel - 1)return !1;
                        i = this.SelectedSKUProperty[0].PropertyNameSet + ";" + t.PropertyNameSet
                    }
                    return !this.SKUDictionaryByPropertyName || !this.SKUDictionaryByPropertyName[i] || !this.SKUDictionaryByPropertyName[i].hasOwnProperty("SellingQty") ? !0 : !this.SKUDictionaryByPropertyName[i].IsShow
                }, t.prototype.UpdateSKUQty = function () {
                    var n = this, i = this.$q.defer(), t = [];
                    return t = this.SKULevel < 2 ? this.SalePage.SaleProductSKUIdList : this._.pluck(this._.filter(this.SalePage.SKUPropertySetList, function (t) {
                            return t.PropertyNameSet.indexOf(n.SelectedSKUProperty[0].PropertyNameSet) === 0
                        }), "SaleProductSKUId"), this.$log.info("Get SellingQtyList - Start", t), this.ProductStockService.GetSellingQtyListNew(t).then(function (r) {
                        n._.each(r.data, function (t) {
                            n.SKUDictionaryById[t.SaleProductSKUId].SellingQty = t.SellingQty;
                            i.resolve()
                        });
                        n.$log.info("Get SellingQtyList - End", t)
                    }, i.reject), i.promise
                }, t.prototype.Confirm = function (t) {
                    var i = this, r = this.addToCartConfig.salePageId, u = this.addToCartConfig.shopId, f;
                    if (this.IsWaiting = !0, !this.SelectedSKUPropertySet)return this.$log.info("SKU not select!"), this.IsWaiting = !1, !1;
                    if (f = this.SKUDictionaryById[this.SelectedSKUPropertySet.SaleProductSKUId].SellingQty, f <= 0)return this.$log.info("SKU no selling qty!"), this.IsWaiting = !1, !1;
                    if (this.Qty < 1)return this.$log.info("SKU no qty!"), this.IsWaiting = !1, !1;
                    this.$log.info("Add ShoppingCart Item - Start", u, r, this.SelectedSKUPropertySet.SaleProductSKUId, this.Qty);
                    this.ShoppingCartService.InsertItem(u, r, this.SelectedSKUPropertySet.SaleProductSKUId, this.Qty).then(function (f) {
                        var s, e, o;
                        i.IsWaiting = !1;
                        i.$log.info("Add ShoppingCart Item - Finish", u, r, i.SelectedSKUPropertySet.SaleProductSKUId, i.Qty, f);
                        i.$rootScope.$emit("RefreshShoppingCartCount");
                        i.$modalInstance.close();
                        !t || (i.$window.location.protocol === "http:" ? (s = i.$window.location.origin + "/V2/ShoppingCart/Preview", e = "/Login/HttpLoginRelayToHttps/?rt=" + encodeURIComponent(s), e += "&reason=addToCart_success", i.$window.location.href = e) : i.$window.location.href = "/V2/ShoppingCart");
                        o = {
                            id: i.SalePage.Id.toString(),
                            name: "(" + i.SalePage.Id + ")" + i.SalePage.Title,
                            price: i.SalePage.Price,
                            position: i.addToCartConfig.position
                        };
                        i.PageValue.CurrentPage === n.Mall.Models.PageNameEnum.SalePageIndex ? i.GoogleAnalyticsEcommerceUtility.AddToCart(o) : i.GoogleAnalyticsEcommerceUtility.AddToCartDirect(o, i.addToCartConfig.listName);
                        i.FacebookUtility.TrackAddToCartEvent([i.SalePage.Id.toString()], i.SalePage.CategoryText + "(" + i.SalePage.ShopCategoryId + ")", i.SalePage.Price, i.SalePage.Title);
                        i.GoogleTagManagerDataLayerUtility.AddToCart(r.toString(), i.Qty, i.SalePage.Price)
                    }, function (n) {
                        if (i.IsWaiting = !1, i.$modalInstance.close(n), !!t)if (i.$window.location.protocol == "http:") {
                            var u = i.$window.location.origin + "/V2/ShoppingCart/Preview", r = "/Login/HttpLoginRelayToHttps/?rt=" + encodeURIComponent(u);
                            r += "&reason=addToCart_success";
                            i.$window.location.href = r
                        } else i.$window.location.href = "/V2/ShoppingCart"
                    })
                }, t.prototype.Cancel = function () {
                    this.$modalInstance.dismiss("Cancel")
                }, t.prototype.FacebookShare = function (n) {
                    var t = this, i = this.$location.protocol() + "://" + this.$location.host() + "/SalePage/Index/" + n;
                    this.$log.debug("Share url:", i);
                    this.IsWaiting = !0;
                    this.Facebook.ui({method: "feed", link: i, display: "popup"}, function (n) {
                        t.IsWaiting = !1;
                        n && (t.SalePage.IsShareToBuy = !1, t.HideBuyButton = !1)
                    })
                }, t.prototype.AppOnly = function (n, t) {
                    window.location.href = this.DeviceValue.IsMobile() ? "/ref/" + t + "/SalePage/" + n : "/SalePage/ShowQRCode/" + n
                }, t.prototype.PickupDefaultSkuForLevel1 = function () {
                    var n = this, t;
                    this.SelectedSKUPropertySet = null;
                    t = !1;
                    angular.forEach(this.SalePage.MajorList[0].SKUList[0].PropertyList, function (i) {
                        var r = i.PropertyNameSet, u = n.SKUDictionaryByPropertyName[r].SellingQty;
                        u > 0 && !t && (n.SelectedSKUProperty[0] = i, n.SelectedSKUPropertySet = n.SKUDictionaryByPropertyName[r], t = !0)
                    });
                    this.Qty = t ? 1 : 0
                }, t.prototype.PickupDefaultSkuForLevel2 = function () {
                    var n = this, t;
                    this.SelectedSKUPropertySet = null;
                    t = !1;
                    angular.forEach(this.SalePage.MajorList[0].SKUList[1].PropertyList, function (i) {
                        var r = n.SelectedSKUProperty[0].PropertyNameSet + ";" + i.PropertyNameSet, u = n.SKUDictionaryByPropertyName[r] ? n.SKUDictionaryByPropertyName[r].SellingQty : 0;
                        u > 0 && !t && (n.SelectedSKUProperty[1] = i, n.SelectedSKUPropertySet = n.SKUDictionaryByPropertyName[r], t = !0)
                    });
                    this.Qty = t ? 1 : 0
                }, t.prototype.chooseSelectedItem = function (n) {
                    var r = this, t = !1, f, i, e, o, s, u, h;
                    n === 0 ? (this.SKULevel === 1 ? f = i = this.chooseItemProperty.PropertyNameSet : this.SKULevel === 2 && (f = this.chooseItemProperty.PropertyNameSet, e = !1, angular.forEach(this.SalePage.SKUPropertySetList, function (n, t) {
                                !e && n.IsShow && (i = r.chooseItemProperty.PropertyNameSet + ";" + r.SalePage.SKUPropertySetList[t].PropertyNameSet.split(";")[1], e = !0)
                            })), o = this.SKUDictionaryByPropertyName[i].SellingQty, o > 0 && !t && (this.SelectedSKUProperty[0] = this.chooseItemProperty, this.SKULevel === 1 ? this.SelectedSKUPropertySet = this.SKUDictionaryByPropertyName[f] : this.SKULevel === 2 && (angular.forEach(this.SalePage.MajorList[0].SKUList[1].PropertyList, function (n, t) {
                                n.PropertyNameSet === i.split(";")[1] && (s = r.SelectedSKUProperty[1] = r.SalePage.MajorList[0].SKUList[1].PropertyList[t])
                            }), this.SelectedSKUProperty[1] = s, this.SelectedSKUPropertySet = this.SKUDictionaryByPropertyName[i]), t = !0)) : (u = this.SelectedSKUProperty[0].PropertyNameSet + ";" + this.chooseItemProperty.PropertyNameSet, h = this.SKUDictionaryByPropertyName[u] ? this.SKUDictionaryByPropertyName[u].SellingQty : 0, h > 0 && !t && (this.SelectedSKUProperty[1] = this.chooseItemProperty, this.SelectedSKUPropertySet = this.SKUDictionaryByPropertyName[u], t = !0));
                    this.Qty = t ? 1 : 0
                }, t.prototype.scrollToItemPosition = function () {
                    var n = document.querySelector(".current"), t = document.querySelector(".scroll-area");
                    n && n.offsetTop + n.offsetHeight >= t.offsetHeight && (t.scrollTop = n.offsetTop - n.offsetHeight)
                }, t.prototype.AddQty = function () {
                    this.SelectedSKUPropertySet && this.Qty < this.SelectedSKUPropertySet.SellingQty && (this.Qty += 1)
                }, t.prototype.MinusQty = function () {
                    this.Qty > 1 && (this.Qty -= 1)
                }, t.prototype.GetCurrentImgSrc = function (n) {
                    var t = "";
                    return this.SalePage.ImageList.map(function (i) {
                        i.SKUPropertyNameSet && i.SKUPropertyNameSet.split("/")[0] === n[0].Name && (t = i.PicUrl)
                    }), t === "" ? this.SalePage.ImageList[0].PicUrl : t
                }, t.$inject = ["$rootScope", "$scope", "$location", "$window", "$log", "$q", "$timeout", "$modalInstance", "underscore", "SalePageService", "ShoppingCartService", "ProductStockService", "addToCartConfig", "Facebook", "GoogleAnalyticsEcommerceUtility", "GoogleTagManagerDataLayerUtility", "FacebookUtility", "PageValue", "DeviceValue"], t
            }();
            t.AddToShoppingCartController = i;
            angular.module("NineYi.Mall.Controllers").controller("AddToShoppingCartController", i)
        })(i = t.Controllers || (t.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}));
__extends = this && this.__extends || function (n, t) {
        function r() {
            this.constructor = n
        }

        for (var i in t)t.hasOwnProperty(i) && (n[i] = t[i]);
        n.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r)
    }, function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function (n) {
                function t() {
                    n.apply(this, arguments)
                }

                return __extends(t, n), t.prototype.Confirm = function () {
                    var t = this.addToCartConfig.salePageId, i = this.addToCartConfig.shopId, n;
                    if (this.IsWaiting = !0, !this.SelectedSKUPropertySet)return this.$log.info("SKU not select!"), this.IsWaiting = !1, !1;
                    if (n = this.SKUDictionaryById[this.SelectedSKUPropertySet.SaleProductSKUId].SellingQty, n <= 0)return this.$log.info("SKU no selling qty!"), this.IsWaiting = !1, !1;
                    if (this.Qty < 1)return this.$log.info("SKU no qty!"), this.IsWaiting = !1, !1;
                    this.$modalInstance.close({
                        ShopId: i,
                        SalePageId: t,
                        SkuLevel1: this.SelectedSKUProperty[0].Name !== "-1" ? this.SelectedSKUProperty[0].Name : "",
                        SkuLevel2: this.SelectedSKUProperty.length === 2 ? this.SelectedSKUProperty[1].Name : "",
                        SaleProductSKUId: this.SelectedSKUPropertySet.SaleProductSKUId,
                        Qty: this.Qty
                    })
                }, t
            }(n.AddToShoppingCartController);
            n.AddToBasketController = t;
            angular.module("NineYi.Mall.Controllers").controller("AddToBasketController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f, e, o, s, h, c, l, a, v, y, p) {
                    var w = this, b;
                    if (this.$rootScope = n, this.$scope = t, this.$log = i, this.value = r, this.$window = u, this.ShopId = f, this.ShopCategoryService = e, this.ActivityService = o, this.OfficialService = s, this.GoogleAnalyticsUtility = h, this.PromotionService = c, this.ECouponService = l, this.CouponService = a, this.LayoutTemplateDataService = v, this.LoadingBarUtility = y, this.CategoryId = p, this.FreeGiftList = [], this.DiscountPriceList = [], this.DeviceSize = this.value.deviceSize, b = _.last(u.location.pathname.split("/")).toString(), this.DeviceSize !== "mobile" || b.toLowerCase() === "official") {
                        this.LoadingBarUtility.EnableLoadingBar();
                        this.LoadingBarUtility.ShowLoadingBar();
                        this.ActivityList = [];
                        this.LayoutTemplateDataList = {};
                        u.nineYiOfficial && (this.CategoryId = u.nineYiOfficial.shopCategoryId);
                        var k = this.$scope.$on("onOfficialPromotionTargetList", function (n, t) {
                            var i, u, r;
                            for (w.OfficialPromotionTargetList = t, i = 0; i <= t.length - 1; i++)if (u = t[i].ConditionDiscountTypeDef, t[i].Targets.length > 0)if (u === "FreeGift")for (r = 0; r <= t[i].Targets.length - 1; r++)w.FreeGiftList.push(t[i].Targets[r]); else if (u === "DiscountPrice" || u === "DiscountRate")for (r = 0; r <= t[i].Targets.length - 1; r++)w.DiscountPriceList.push(t[i].Targets[r]);
                            k()
                        }), d = this.$scope.$on("onShopCategoryObj", function (n, t) {
                            w.ShopCategoryObj = t;
                            w.SetActiveLink(w.ShopCategoryObj.List, w.CategoryId);
                            d()
                        }), g = this.$scope.$on("onLayoutTemplateDataList", function (n, t) {
                            w.LayoutTemplateDataList = t;
                            g()
                        });
                        this.$log.info("Get PromotionList - start");
                        this.PromotionService.GetOfficialPromotionHotSaleRankingList(this.ShopId).then(function (n) {
                            n.length !== 0 && (w.OriginPromotionListLength = n.length, w.PromotionList = n.length < 6 ? n : n.splice(0, 5), w.$log.info("Get Promotion - Finish"))
                        });
                        this.$log.info("Get OfficialECouponList - start");
                        this.ECouponService.GetOfficialECouponList(this.ShopId).then(function (n) {
                            n.length !== 0 && (w.OriginECouponListLength = n[0].ECouponList.length, w.OfficialECouponList = n[0].ECouponList.length < 6 ? n[0].ECouponList : n[0].ECouponList.splice(0, 5), w.$log.info("Get OfficialECouponList - Finish"))
                        });
                        this.$log.info("Get CouponList - start");
                        this.CouponService.GetCouponList(this.ShopId).then(function (n) {
                            n.length !== 0 && (w.OriginCouponListLength = n.length, w.CouponList = n.length < 6 ? n : n.splice(0, 5), w.$log.info("Get CouponList - Finish"))
                        });
                        this.$log.info("Get ActivityList - start");
                        this.ActivityService.GetActivityList(this.ShopId).then(function (n) {
                            n.length !== 0 && (w.ActivityList = n, w.$log.info("Get ActivityList - Finish"))
                        });
                        this.$rootScope.$on("OfficialIndexCtrl.TrackEvent", function (n, t, i, r, u) {
                            w.TrackEvent(t, i, r, u)
                        })
                    }
                }

                return n.prototype.selectLevel1List = function (n, t) {
                    n.ChildList ? n.selected = !n.selected : this.$window.location.href = t + "/v2/official/SalePageCategory/" + n.ShopCategory_Id
                }, n.prototype.TrackEvent = function (n, t, i, r) {
                    this.GoogleAnalyticsUtility.TrackEvent(n, t, i, r)
                }, n.prototype.SetActiveLink = function (n, t) {
                    t && [].slice.call(n).forEach(function (n) {
                        if (+n.ShopCategory_Id == +t) {
                            n.active = !0;
                            return
                        }
                        n.ChildList && [].slice.call(n.ChildList).forEach(function (i) {
                            if (+i.ShopCategory_Id == +t) {
                                i.active = !0;
                                n.selected = !0;
                                return
                            }
                        })
                    })
                }, n.$inject = ["$rootScope", "$scope", "$log", "Mall.Value", "$window", "ShopId", "ShopCategoryService", "ActivityService", "OfficialService", "GoogleAnalyticsUtility", "PromotionService", "ECouponService", "CouponService", "LayoutTemplateDataService", "LoadingBarUtility"], n
            }();
            n.ShopCategoryController = t;
            angular.module("NineYi.Mall.Controllers").controller("ShopCategoryController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.$rootScope = n;
                    this.$scope = t;
                    this.$log = i;
                    this.$window = r;
                    this.GoogleAnalyticsUtility = u
                }

                return n.prototype.TrackEvent = function (n, t, i, r) {
                    this.GoogleAnalyticsUtility.TrackEvent(n, t, i, r)
                }, n.$inject = ["$rootScope", "$scope", "$log", "$window", "GoogleAnalyticsUtility"], n
            }();
            n.ErrorPageController = t;
            angular.module("NineYi.Mall.Controllers").controller("ErrorPageController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u, f, e, o, s) {
                    this.$scope = n;
                    this.$log = t;
                    this.$window = i;
                    this.ShopId = r;
                    this.GoogleAnalyticsEcommerceUtility = u;
                    this.GoogleTagManagerDataLayerUtility = f;
                    this.PageValue = e;
                    this.ShoppingCartUtility = o;
                    this.RefUtility = s
                }

                return n.prototype.AddToCart = function (n, t, i, r) {
                    var u = this;
                    this.ShoppingCartUtility.AddToCart(n, this.ShopId, r, t, i).then(function (n) {
                        if (n) {
                            u.ShoppingCartUtility.AddToCartResult(n, 750, !1);
                            return
                        }
                        u.ShoppingCartUtility.AddToCartResult("加入成功", 750, !0)
                    })
                }, n.prototype.GetDownloadAppUrl = function () {
                    return this.RefUtility.ReplaceRefUrl(this.PageValue.CurrentPage)
                }, n.$inject = ["$scope", "$log", "$window", "ShopId", "GoogleAnalyticsEcommerceUtility", "GoogleTagManagerDataLayerUtility", "PageValue", "ShoppingCartUtility", "RefUtility"], n
            }();
            n.CompatibilityAdapterController = t;
            angular.module("NineYi.Mall.Controllers").controller("CompatibilityAdapterController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.$scope = n;
                    this.$log = t;
                    this.MainMenuUtility = i;
                    this.FreezeBodyUtility = r;
                    this.DeviceValue = u;
                    this.IsMobile = this.DeviceValue.IsMobile()
                }

                return n.prototype.ShowMenu = function () {
                    this.IsMobile && (this.MainMenuUtility.Toggle("category"), this.FreezeBodyUtility.ToogleFreezeBody())
                }, n.$inject = ["$scope", "$log", "MainMenuUtility", "FreezeBodyUtility", "DeviceValue"], n
            }();
            n.BreadcrumbController = t;
            angular.module("NineYi.Mall.Controllers").controller("BreadcrumbController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {})), function (n) {
    var t;
    (function (n) {
        var t;
        (function (n) {
            var t = function () {
                function n(n, t, i, r, u) {
                    this.$rootScope = n;
                    this.$scope = t;
                    this.$log = i;
                    this.$window = r;
                    this.ShopId = u
                }

                return n.$inject = ["$rootScope", "$scope", "$log", "$window", "ShopId"], n
            }();
            n.OfficialAccountAsideBarController = t;
            angular.module("NineYi.Mall.Controllers").controller("OfficialAccountAsideBarController", t)
        })(t = n.Controllers || (n.Controllers = {}))
    })(t = n.Mall || (n.Mall = {}))
}(NineYi || (NineYi = {}))